@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 3 | - exit( 'No direct script access allowed' ); |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | + exit('No direct script access allowed'); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * @return EED_Core_Rest_Api |
| 23 | 23 | */ |
| 24 | 24 | public static function instance() { |
| 25 | - return parent::get_instance( __CLASS__ ); |
|
| 25 | + return parent::get_instance(__CLASS__); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | public static function set_hooks_both() { |
| 55 | - add_action( 'rest_api_init', array( 'EED_Core_REST_API', 'register_routes' ) ); |
|
| 56 | - add_filter( 'rest_route_data', array( 'EED_Core_REST_API', 'hide_old_endpoints' ), 10, 2 ); |
|
| 57 | - add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) ); |
|
| 55 | + add_action('rest_api_init', array('EED_Core_REST_API', 'register_routes')); |
|
| 56 | + add_filter('rest_route_data', array('EED_Core_REST_API', 'hide_old_endpoints'), 10, 2); |
|
| 57 | + add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index')); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
@@ -63,16 +63,16 @@ discard block |
||
| 63 | 63 | * so we actually prefer to only do it when an EE plugin is activated or upgraded |
| 64 | 64 | */ |
| 65 | 65 | public static function register_routes() { |
| 66 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
| 67 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
| 68 | - foreach( $routes as $route ) { |
|
| 66 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
| 67 | + foreach ($relative_urls as $endpoint => $routes) { |
|
| 68 | + foreach ($routes as $route) { |
|
| 69 | 69 | register_rest_route( |
| 70 | 70 | $namespace, |
| 71 | 71 | $endpoint, |
| 72 | 72 | array( |
| 73 | - 'callback' => $route[ 'callback' ], |
|
| 74 | - 'methods' => $route[ 'methods' ], |
|
| 75 | - 'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(), |
|
| 73 | + 'callback' => $route['callback'], |
|
| 74 | + 'methods' => $route['methods'], |
|
| 75 | + 'args' => isset($route['args']) ? $route['args'] : array(), |
|
| 76 | 76 | ) |
| 77 | 77 | ); |
| 78 | 78 | } |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | * } |
| 90 | 90 | */ |
| 91 | 91 | public static function get_ee_route_data() { |
| 92 | - $ee_routes = get_option( self::saved_routes_option_names, null ); |
|
| 93 | - if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){ |
|
| 92 | + $ee_routes = get_option(self::saved_routes_option_names, null); |
|
| 93 | + if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) { |
|
| 94 | 94 | self::save_ee_routes(); |
| 95 | - $ee_routes = get_option( self::saved_routes_option_names, array() ); |
|
| 95 | + $ee_routes = get_option(self::saved_routes_option_names, array()); |
|
| 96 | 96 | } |
| 97 | 97 | return $ee_routes; |
| 98 | 98 | } |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | * @return void |
| 104 | 104 | */ |
| 105 | 105 | public static function save_ee_routes() { |
| 106 | - if( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
| 106 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
| 107 | 107 | $instance = self::instance(); |
| 108 | 108 | $routes = array_replace_recursive( |
| 109 | 109 | $instance->_register_config_routes(), |
| 110 | 110 | $instance->_register_meta_routes(), |
| 111 | 111 | $instance->_register_model_routes() |
| 112 | 112 | ); |
| 113 | - update_option( self::saved_routes_option_names, $routes, true ); |
|
| 113 | + update_option(self::saved_routes_option_names, $routes, true); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * @return array @see get_ee_route_data |
| 120 | 120 | */ |
| 121 | 121 | protected function _register_model_routes() { |
| 122 | - EE_Registry::instance()->load_helper( 'Inflector' ); |
|
| 122 | + EE_Registry::instance()->load_helper('Inflector'); |
|
| 123 | 123 | $models_to_register = apply_filters( |
| 124 | 124 | 'FHEE__EED_Core_REST_API___register_model_routes', |
| 125 | 125 | EE_Registry::instance()->non_abstract_db_models |
@@ -128,23 +128,23 @@ discard block |
||
| 128 | 128 | unset($models_to_register['Extra_Meta']); |
| 129 | 129 | unset($models_to_register['Extra_Join']); |
| 130 | 130 | $model_routes = array( ); |
| 131 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
| 131 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
| 132 | 132 | |
| 133 | - foreach ( $models_to_register as $model_name => $model_classname ) { |
|
| 133 | + foreach ($models_to_register as $model_name => $model_classname) { |
|
| 134 | 134 | //yes we could just register one route for ALL models, but then they wouldn't show up in the index |
| 135 | - $ee_namespace = self::ee_api_namespace . $version; |
|
| 136 | - $plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name ); |
|
| 137 | - $singular_model_route = $plural_model_route . '/(?P<id>\d+)' ; |
|
| 138 | - $model_routes[ $ee_namespace ][ $plural_model_route ] = array( |
|
| 135 | + $ee_namespace = self::ee_api_namespace.$version; |
|
| 136 | + $plural_model_route = EEH_Inflector::pluralize_and_lower($model_name); |
|
| 137 | + $singular_model_route = $plural_model_route.'/(?P<id>\d+)'; |
|
| 138 | + $model_routes[$ee_namespace][$plural_model_route] = array( |
|
| 139 | 139 | array( |
| 140 | 140 | 'callback' => array( |
| 141 | 141 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
| 142 | 142 | 'handle_request_get_all' ), |
| 143 | 143 | 'methods' => WP_REST_Server::READABLE, |
| 144 | 144 | 'hidden_endpoint' => $hidden_endpoint, |
| 145 | - 'args' => $this->_get_read_query_params( $model_name ), |
|
| 145 | + 'args' => $this->_get_read_query_params($model_name), |
|
| 146 | 146 | '_links' => array( |
| 147 | - 'self' => rest_url( $ee_namespace . $singular_model_route ), |
|
| 147 | + 'self' => rest_url($ee_namespace.$singular_model_route), |
|
| 148 | 148 | ) |
| 149 | 149 | ), |
| 150 | 150 | // array( |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | // 'hidden_endpoint' => $hidden_endpoint |
| 156 | 156 | // ) |
| 157 | 157 | ); |
| 158 | - $model_routes[ $ee_namespace ][ $singular_model_route ] = array( |
|
| 158 | + $model_routes[$ee_namespace][$singular_model_route] = array( |
|
| 159 | 159 | array( |
| 160 | 160 | 'callback' => array( |
| 161 | 161 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | 'include' => array( |
| 167 | 167 | 'required' => false, |
| 168 | 168 | 'default' => '*', |
| 169 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ), |
|
| 169 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'), |
|
| 170 | 170 | ), |
| 171 | 171 | ) |
| 172 | 172 | ), |
@@ -179,20 +179,20 @@ discard block |
||
| 179 | 179 | // ), |
| 180 | 180 | ); |
| 181 | 181 | //@todo: also handle DELETE for a single item |
| 182 | - $model = EE_Registry::instance()->load_model( $model_classname ); |
|
| 183 | - foreach ( $model->relation_settings() as $relation_name => $relation_obj ) { |
|
| 182 | + $model = EE_Registry::instance()->load_model($model_classname); |
|
| 183 | + foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
| 184 | 184 | $related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name( |
| 185 | 185 | $relation_name, |
| 186 | 186 | $relation_obj |
| 187 | 187 | ); |
| 188 | - $model_routes[ $ee_namespace ][ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array( |
|
| 188 | + $model_routes[$ee_namespace][$singular_model_route.'/'.$related_model_name_endpoint_part] = array( |
|
| 189 | 189 | array( |
| 190 | 190 | 'callback' => array( |
| 191 | 191 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
| 192 | 192 | 'handle_request_get_related' ), |
| 193 | 193 | 'methods' => WP_REST_Server::READABLE, |
| 194 | 194 | 'hidden_endpoint' => $hidden_endpoint, |
| 195 | - 'args' => $this->_get_read_query_params( $relation_name ), |
|
| 195 | + 'args' => $this->_get_read_query_params($relation_name), |
|
| 196 | 196 | ), |
| 197 | 197 | // array( |
| 198 | 198 | // 'callback' => array( |
@@ -215,47 +215,47 @@ discard block |
||
| 215 | 215 | * @param string $model_name eg 'Event' or 'Venue' |
| 216 | 216 | * @return array describing the args acceptable when querying this model |
| 217 | 217 | */ |
| 218 | - protected function _get_read_query_params( $model_name ) { |
|
| 219 | - $model = EE_Registry::instance()->load_model( $model_name ); |
|
| 218 | + protected function _get_read_query_params($model_name) { |
|
| 219 | + $model = EE_Registry::instance()->load_model($model_name); |
|
| 220 | 220 | $default_orderby = array(); |
| 221 | - foreach( $model->get_combined_primary_key_fields() as $key_field ) { |
|
| 222 | - $default_orderby[ $key_field->get_name() ] = 'ASC'; |
|
| 221 | + foreach ($model->get_combined_primary_key_fields() as $key_field) { |
|
| 222 | + $default_orderby[$key_field->get_name()] = 'ASC'; |
|
| 223 | 223 | } |
| 224 | 224 | return array( |
| 225 | 225 | 'where' => array( |
| 226 | 226 | 'required' => false, |
| 227 | 227 | 'default' => array(), |
| 228 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso' ), |
|
| 228 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso'), |
|
| 229 | 229 | ), |
| 230 | 230 | 'limit' => array( |
| 231 | 231 | 'required' => false, |
| 232 | 232 | 'default' => 50, |
| 233 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso' ) |
|
| 233 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso') |
|
| 234 | 234 | ), |
| 235 | 235 | 'order_by' => array( |
| 236 | 236 | 'required' => false, |
| 237 | 237 | 'default' => $default_orderby, |
| 238 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso' ) |
|
| 238 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso') |
|
| 239 | 239 | ), |
| 240 | 240 | 'group_by' => array( |
| 241 | 241 | 'required' => false, |
| 242 | 242 | 'default' => null, |
| 243 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso' ) |
|
| 243 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso') |
|
| 244 | 244 | ), |
| 245 | 245 | 'having' => array( |
| 246 | 246 | 'required' => false, |
| 247 | 247 | 'default' => null, |
| 248 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso' ) |
|
| 248 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso') |
|
| 249 | 249 | ), |
| 250 | 250 | 'caps' => array( |
| 251 | 251 | 'required' => false, |
| 252 | 252 | 'default' => EEM_Base::caps_read, |
| 253 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso' ) |
|
| 253 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso') |
|
| 254 | 254 | ), |
| 255 | 255 | 'include' => array( |
| 256 | 256 | 'required' => false, |
| 257 | 257 | 'default' => '*', |
| 258 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ), |
|
| 258 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'), |
|
| 259 | 259 | ), |
| 260 | 260 | ); |
| 261 | 261 | } |
@@ -266,8 +266,8 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | protected function _register_config_routes() { |
| 268 | 268 | $config_routes = array(); |
| 269 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
| 270 | - $config_routes[ self::ee_api_namespace . $version ][ 'config' ] = array( |
|
| 269 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
| 270 | + $config_routes[self::ee_api_namespace.$version]['config'] = array( |
|
| 271 | 271 | array( |
| 272 | 272 | 'callback' => array( |
| 273 | 273 | 'EventEspresso\core\libraries\rest_api\controllers\config\Read', |
@@ -286,8 +286,8 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | protected function _register_meta_routes() { |
| 288 | 288 | $meta_routes = array(); |
| 289 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
| 290 | - $meta_routes[ self::ee_api_namespace . $version ][ '/resources' ] = array( |
|
| 289 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
| 290 | + $meta_routes[self::ee_api_namespace.$version]['/resources'] = array( |
|
| 291 | 291 | array( |
| 292 | 292 | 'callback' => array( |
| 293 | 293 | 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', |
@@ -308,13 +308,13 @@ discard block |
||
| 308 | 308 | * @param array $route_data |
| 309 | 309 | * @return array |
| 310 | 310 | */ |
| 311 | - public function hide_old_endpoints( $route_data ) { |
|
| 312 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
| 313 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
| 314 | - foreach( $routes as $route ) { |
|
| 315 | - if( $route[ 'hidden_endpoint' ] ) { |
|
| 316 | - $full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' ); |
|
| 317 | - unset( $route_data[ $full_route ] ); |
|
| 311 | + public function hide_old_endpoints($route_data) { |
|
| 312 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
| 313 | + foreach ($relative_urls as $endpoint => $routes) { |
|
| 314 | + foreach ($routes as $route) { |
|
| 315 | + if ($route['hidden_endpoint']) { |
|
| 316 | + $full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/'); |
|
| 317 | + unset($route_data[$full_route]); |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | } |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * @return array |
| 335 | 335 | */ |
| 336 | 336 | public static function version_compatibilities() { |
| 337 | - return apply_filters( 'FHEE__EED_Core_REST_API__version_compatibilities', array( '4.8.29' => '4.8.29' ) ); |
|
| 337 | + return apply_filters('FHEE__EED_Core_REST_API__version_compatibilities', array('4.8.29' => '4.8.29')); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
@@ -348,17 +348,17 @@ discard block |
||
| 348 | 348 | public static function versions_served() { |
| 349 | 349 | $version_compatibilities = EED_Core_Rest_Api::version_compatibilities(); |
| 350 | 350 | $versions_served = array(); |
| 351 | - $lowest_compatible_version = $version_compatibilities[ EED_Core_Rest_Api::core_version() ]; |
|
| 351 | + $lowest_compatible_version = $version_compatibilities[EED_Core_Rest_Api::core_version()]; |
|
| 352 | 352 | //for each version of core we have ever served: |
| 353 | - foreach( array_keys( EED_Core_Rest_Api::version_compatibilities() ) as $possibly_served_version ) { |
|
| 353 | + foreach (array_keys(EED_Core_Rest_Api::version_compatibilities()) as $possibly_served_version) { |
|
| 354 | 354 | //if it's not above the current core version, and it's compatible with the current version of core |
| 355 | - if( |
|
| 355 | + if ( |
|
| 356 | 356 | $possibly_served_version < EED_Core_Rest_Api::core_version() |
| 357 | 357 | && $possibly_served_version >= $lowest_compatible_version |
| 358 | 358 | ) { |
| 359 | - $versions_served[ $possibly_served_version ] = true; |
|
| 360 | - }else { |
|
| 361 | - $versions_served[ $possibly_served_version ] = false; |
|
| 359 | + $versions_served[$possibly_served_version] = true; |
|
| 360 | + } else { |
|
| 361 | + $versions_served[$possibly_served_version] = false; |
|
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | return $versions_served; |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | * @return string |
| 372 | 372 | */ |
| 373 | 373 | public static function core_version() { |
| 374 | - return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) ); |
|
| 374 | + return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3))); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | * @param WP $WP |
| 384 | 384 | * @return void |
| 385 | 385 | */ |
| 386 | - public function run( $WP ) { |
|
| 386 | + public function run($WP) { |
|
| 387 | 387 | |
| 388 | 388 | } |
| 389 | 389 | |
@@ -257,7 +257,7 @@ |
||
| 257 | 257 | * @param int $TXN_ID |
| 258 | 258 | * @param int $ATT_ID |
| 259 | 259 | * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
| 260 | - * @return mixed array on success, FALSE on fail |
|
| 260 | + * @return EE_Base_Class|null array on success, FALSE on fail |
|
| 261 | 261 | */ |
| 262 | 262 | public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
| 263 | 263 | return $this->get_one(array( |
@@ -1,26 +1,26 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
| 2 | 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 {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
| 11 | - * @ link {@link http://www.eventespresso.com} |
|
| 12 | - * @ since 4.0 |
|
| 13 | - * |
|
| 14 | - * ------------------------------------------------------------------------ |
|
| 15 | - * |
|
| 16 | - * Registrations Table class |
|
| 17 | - * |
|
| 18 | - * @package Event Espresso |
|
| 19 | - * @subpackage includes/admin_screens/Registrations_List_Table.class.php |
|
| 20 | - * @author Brent Christensen |
|
| 21 | - * |
|
| 22 | - * ------------------------------------------------------------------------ |
|
| 23 | - */ |
|
| 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 {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
| 11 | + * @ link {@link http://www.eventespresso.com} |
|
| 12 | + * @ since 4.0 |
|
| 13 | + * |
|
| 14 | + * ------------------------------------------------------------------------ |
|
| 15 | + * |
|
| 16 | + * Registrations Table class |
|
| 17 | + * |
|
| 18 | + * @package Event Espresso |
|
| 19 | + * @subpackage includes/admin_screens/Registrations_List_Table.class.php |
|
| 20 | + * @author Brent Christensen |
|
| 21 | + * |
|
| 22 | + * ------------------------------------------------------------------------ |
|
| 23 | + */ |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | class EE_Registrations_List_Table extends EE_Admin_List_Table { |
@@ -337,12 +337,12 @@ discard block |
||
| 337 | 337 | * @param \EE_Registration $item |
| 338 | 338 | * @return string |
| 339 | 339 | */ |
| 340 | - function column_cb($item){ |
|
| 340 | + function column_cb($item){ |
|
| 341 | 341 | /** checkbox/lock **/ |
| 342 | 342 | $transaction = $item->get_first_related( 'Transaction' ); |
| 343 | 343 | $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
| 344 | 344 | return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ); |
| 345 | - } |
|
| 345 | + } |
|
| 346 | 346 | |
| 347 | 347 | |
| 348 | 348 | |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | */ |
| 377 | 377 | function column__REG_date(EE_Registration $item){ |
| 378 | 378 | $this->_set_related_details($item); |
| 379 | - //Build row actions |
|
| 379 | + //Build row actions |
|
| 380 | 380 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
| 381 | 381 | $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
| 382 | 382 | $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | } else { |
| 429 | 429 | return __( 'There is no ticket on this registration', 'event_espresso' ); |
| 430 | 430 | } |
| 431 | - } |
|
| 431 | + } |
|
| 432 | 432 | |
| 433 | 433 | |
| 434 | 434 | |
@@ -450,14 +450,14 @@ discard block |
||
| 450 | 450 | $t = $item->get_first_related('Transaction'); |
| 451 | 451 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
| 452 | 452 | |
| 453 | - //append group count to name |
|
| 454 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
| 453 | + //append group count to name |
|
| 454 | + $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
| 455 | 455 | |
| 456 | - //append reg_code |
|
| 457 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
| 456 | + //append reg_code |
|
| 457 | + $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
| 458 | 458 | |
| 459 | - //reg status text for accessibility |
|
| 460 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
| 459 | + //reg status text for accessibility |
|
| 460 | + $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
| 461 | 461 | |
| 462 | 462 | //trash/restore/delete actions |
| 463 | 463 | $actions = array(); |
@@ -57,20 +57,20 @@ discard block |
||
| 57 | 57 | * @param \EE_Admin_Page $admin_page |
| 58 | 58 | * @return EE_Registrations_List_Table |
| 59 | 59 | */ |
| 60 | - function __construct( $admin_page ){ |
|
| 60 | + function __construct($admin_page) { |
|
| 61 | 61 | |
| 62 | - if ( ! empty( $_GET['event_id'] ) ) { |
|
| 62 | + if ( ! empty($_GET['event_id'])) { |
|
| 63 | 63 | $extra_query_args = array(); |
| 64 | - foreach ( $admin_page->get_views() as $key => $view_details ) { |
|
| 65 | - $extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] ); |
|
| 64 | + foreach ($admin_page->get_views() as $key => $view_details) { |
|
| 65 | + $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
| 66 | 66 | } |
| 67 | - $this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args ); |
|
| 67 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | parent::__construct($admin_page); |
| 71 | 71 | $this->_status = $this->_admin_page->get_registration_status_array(); |
| 72 | 72 | |
| 73 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 73 | + EE_Registry::instance()->load_helper('Template'); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | * @return void |
| 82 | 82 | */ |
| 83 | 83 | protected function _setup_data() { |
| 84 | - $this->_data = $this->_admin_page->get_registrations( $this->_per_page ); |
|
| 85 | - $this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE ); |
|
| 84 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
| 85 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
@@ -101,45 +101,45 @@ discard block |
||
| 101 | 101 | ); |
| 102 | 102 | |
| 103 | 103 | |
| 104 | - if ( isset( $_GET['event_id'] )) { |
|
| 104 | + if (isset($_GET['event_id'])) { |
|
| 105 | 105 | $this->_columns = array( |
| 106 | 106 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
| 107 | - '_REG_ID' => __( 'ID', 'event_espresso' ), |
|
| 108 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
| 107 | + '_REG_ID' => __('ID', 'event_espresso'), |
|
| 108 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
| 109 | 109 | 'ATT_email' => __('Email', 'event_espresso'), |
| 110 | - '_REG_date' => __( 'Reg Date', 'event_espresso' ), |
|
| 111 | - 'PRC_amount' => __( 'TKT Price', 'event_espresso' ), |
|
| 112 | - '_REG_final_price' => __( 'Final Price', 'event_espresso' ), |
|
| 113 | - 'TXN_total' => __( 'Total Txn', 'event_espresso' ), |
|
| 110 | + '_REG_date' => __('Reg Date', 'event_espresso'), |
|
| 111 | + 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
| 112 | + '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
| 113 | + 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
| 114 | 114 | 'TXN_paid' => __('Paid', 'event_espresso'), |
| 115 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
| 115 | + 'actions' => __('Actions', 'event_espresso') |
|
| 116 | 116 | ); |
| 117 | 117 | $this->_bottom_buttons = array( |
| 118 | 118 | 'report'=> array( |
| 119 | 119 | 'route' => 'registrations_report', |
| 120 | 120 | 'extra_request' => |
| 121 | 121 | array( |
| 122 | - 'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, |
|
| 123 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
| 122 | + 'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
| 123 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
| 124 | 124 | ), |
| 125 | 125 | ); |
| 126 | 126 | } else { |
| 127 | 127 | $this->_columns = array( |
| 128 | 128 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
| 129 | - '_REG_ID' => __( 'ID', 'event_espresso' ), |
|
| 130 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
| 131 | - '_REG_date' => __( 'TXN Date', 'event_espresso' ), |
|
| 132 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
| 133 | - 'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ), |
|
| 134 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
| 135 | - '_REG_paid' => __( 'Paid', 'event_espresso' ), |
|
| 136 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
| 129 | + '_REG_ID' => __('ID', 'event_espresso'), |
|
| 130 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
| 131 | + '_REG_date' => __('TXN Date', 'event_espresso'), |
|
| 132 | + 'event_name' => __('Event', 'event_espresso'), |
|
| 133 | + 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
| 134 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
| 135 | + '_REG_paid' => __('Paid', 'event_espresso'), |
|
| 136 | + 'actions' => __('Actions', 'event_espresso') |
|
| 137 | 137 | ); |
| 138 | 138 | $this->_bottom_buttons = array( |
| 139 | 139 | 'report_all'=> array( |
| 140 | 140 | 'route' => 'registrations_report', |
| 141 | 141 | 'extra_request' => array( |
| 142 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
| 142 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
| 143 | 143 | ), |
| 144 | 144 | ); |
| 145 | 145 | } |
@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | $this->_primary_column = '_REG_ID'; |
| 148 | 148 | |
| 149 | 149 | $this->_sortable_columns = array( |
| 150 | - '_REG_date' => array( '_REG_date' => TRUE ), //true means its already sorted |
|
| 151 | - 'ATT_fname' => array( 'ATT_fname' => FALSE ), |
|
| 152 | - 'event_name' => array( 'event_name' => FALSE ), |
|
| 153 | - 'DTT_EVT_start' => array( 'DTT_EVT_start' => FALSE ), |
|
| 154 | - '_REG_ID' => array( '_REG_ID' => FALSE ), |
|
| 150 | + '_REG_date' => array('_REG_date' => TRUE), //true means its already sorted |
|
| 151 | + 'ATT_fname' => array('ATT_fname' => FALSE), |
|
| 152 | + 'event_name' => array('event_name' => FALSE), |
|
| 153 | + 'DTT_EVT_start' => array('DTT_EVT_start' => FALSE), |
|
| 154 | + '_REG_ID' => array('_REG_ID' => FALSE), |
|
| 155 | 155 | ); |
| 156 | 156 | |
| 157 | 157 | $this->_hidden_columns = array(); |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | |
| 162 | 162 | |
| 163 | - protected function _get_row_class( $item ) { |
|
| 164 | - $class = parent::_get_row_class( $item ); |
|
| 163 | + protected function _get_row_class($item) { |
|
| 164 | + $class = parent::_get_row_class($item); |
|
| 165 | 165 | //add status class |
| 166 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
| 167 | - if ( $this->_has_checkbox_column ) { |
|
| 166 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
| 167 | + if ($this->_has_checkbox_column) { |
|
| 168 | 168 | $class .= ' has-checkbox-column'; |
| 169 | 169 | } |
| 170 | 170 | return $class; |
@@ -177,15 +177,15 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * @param EE_Registration $registration |
| 179 | 179 | */ |
| 180 | - protected function _set_related_details( EE_Registration $registration ) { |
|
| 180 | + protected function _set_related_details(EE_Registration $registration) { |
|
| 181 | 181 | |
| 182 | - $transaction = $registration->get_first_related( 'Transaction' ); |
|
| 182 | + $transaction = $registration->get_first_related('Transaction'); |
|
| 183 | 183 | $status = $transaction instanceof EE_Transaction ? $transaction->status_ID() : EEM_Transaction::failed_status_code; |
| 184 | 184 | $this->_transaction_details = array( |
| 185 | 185 | 'transaction' => $transaction, |
| 186 | 186 | 'status' => $status, |
| 187 | 187 | 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
| 188 | - 'title_attr' => sprintf( __('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) ) |
|
| 188 | + 'title_attr' => sprintf(__('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence')) |
|
| 189 | 189 | ); |
| 190 | 190 | |
| 191 | 191 | $event = $registration->event(); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | 'event' => $event, |
| 195 | 195 | 'status' => $status, |
| 196 | 196 | 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
| 197 | - 'title_attr' => sprintf( __('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) ) |
|
| 197 | + 'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence')) |
|
| 198 | 198 | ); |
| 199 | 199 | } |
| 200 | 200 | |
@@ -209,26 +209,26 @@ discard block |
||
| 209 | 209 | $filters = array(); |
| 210 | 210 | |
| 211 | 211 | //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
| 212 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
| 212 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
| 213 | 213 | |
| 214 | - $cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : ''; |
|
| 215 | - $cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
| 216 | - $reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : ''; |
|
| 214 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
| 215 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
| 216 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
| 217 | 217 | |
| 218 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category ); |
|
| 219 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category ); |
|
| 218 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
| 219 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
| 220 | 220 | |
| 221 | 221 | $status = array(); |
| 222 | - $status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') ); |
|
| 223 | - foreach ( $this->_status as $key => $value ) { |
|
| 224 | - $status[] = array( 'id' => $key, 'text' => $value ); |
|
| 222 | + $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
| 223 | + foreach ($this->_status as $key => $value) { |
|
| 224 | + $status[] = array('id' => $key, 'text' => $value); |
|
| 225 | 225 | } |
| 226 | - if ( $this->_view != 'incomplete' ) { |
|
| 227 | - $filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset( $this->_req_data['_reg_status'] ) ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) : '' ); |
|
| 226 | + if ($this->_view != 'incomplete') { |
|
| 227 | + $filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) : ''); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - if ( isset( $this->_req_data['event_id'] ) ) { |
|
| 231 | - $filters[] = EEH_Form_Fields::hidden_input( 'event_id', $this->_req_data['event_id'], 'reg_event_id' ); |
|
| 230 | + if (isset($this->_req_data['event_id'])) { |
|
| 231 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | return $filters; |
@@ -245,9 +245,9 @@ discard block |
||
| 245 | 245 | $this->_views['all']['count'] = $this->_total_registrations(); |
| 246 | 246 | $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
| 247 | 247 | $this->_views['today']['count'] = $this->_total_registrations_today(); |
| 248 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) { |
|
| 249 | - $this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' ); |
|
| 250 | - $this->_views['trash']['count'] = $this->_total_registrations( 'trash' ); |
|
| 248 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) { |
|
| 249 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
| 250 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
@@ -259,23 +259,23 @@ discard block |
||
| 259 | 259 | * @param string $view |
| 260 | 260 | * @return int |
| 261 | 261 | */ |
| 262 | - protected function _total_registrations( $view = '' ){ |
|
| 262 | + protected function _total_registrations($view = '') { |
|
| 263 | 263 | $_where = array(); |
| 264 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
| 265 | - if( $EVT_ID ) { |
|
| 264 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
| 265 | + if ($EVT_ID) { |
|
| 266 | 266 | $_where['EVT_ID'] = $EVT_ID; |
| 267 | 267 | } |
| 268 | - switch ( $view ) { |
|
| 268 | + switch ($view) { |
|
| 269 | 269 | case 'trash' : |
| 270 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
| 270 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
| 271 | 271 | break; |
| 272 | 272 | case 'incomplete' : |
| 273 | 273 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
| 274 | 274 | break; |
| 275 | 275 | default : |
| 276 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
| 276 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
| 277 | 277 | } |
| 278 | - return EEM_Registration::instance()->count( array( $_where )); |
|
| 278 | + return EEM_Registration::instance()->count(array($_where)); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | |
@@ -285,24 +285,24 @@ discard block |
||
| 285 | 285 | * @access protected |
| 286 | 286 | * @return int |
| 287 | 287 | */ |
| 288 | - protected function _total_registrations_this_month(){ |
|
| 289 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
| 290 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
| 288 | + protected function _total_registrations_this_month() { |
|
| 289 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
| 290 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
| 291 | 291 | $this_year_r = date('Y', current_time('timestamp')); |
| 292 | 292 | $time_start = ' 00:00:00'; |
| 293 | 293 | $time_end = ' 23:59:59'; |
| 294 | 294 | $this_month_r = date('m', current_time('timestamp')); |
| 295 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
| 295 | + $days_this_month = date('t', current_time('timestamp')); |
|
| 296 | 296 | //setup date query. |
| 297 | - $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ); |
|
| 298 | - $end_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ); |
|
| 299 | - $_where['REG_date']= array('BETWEEN', |
|
| 297 | + $beginning_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'); |
|
| 298 | + $end_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s'); |
|
| 299 | + $_where['REG_date'] = array('BETWEEN', |
|
| 300 | 300 | array( |
| 301 | 301 | $beginning_string, |
| 302 | 302 | $end_string |
| 303 | 303 | )); |
| 304 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
| 305 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
| 304 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
| 305 | + return EEM_Registration::instance()->count(array($_where)); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | |
@@ -312,20 +312,20 @@ discard block |
||
| 312 | 312 | * @access protected |
| 313 | 313 | * @return int |
| 314 | 314 | */ |
| 315 | - protected function _total_registrations_today(){ |
|
| 315 | + protected function _total_registrations_today() { |
|
| 316 | 316 | |
| 317 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
| 318 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
| 317 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
| 318 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
| 319 | 319 | $current_date = date('Y-m-d', current_time('timestamp')); |
| 320 | 320 | $time_start = ' 00:00:00'; |
| 321 | 321 | $time_end = ' 23:59:59'; |
| 322 | - $_where['REG_date']= array('BETWEEN', |
|
| 322 | + $_where['REG_date'] = array('BETWEEN', |
|
| 323 | 323 | array( |
| 324 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ), |
|
| 325 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' ) |
|
| 324 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'), |
|
| 325 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s') |
|
| 326 | 326 | )); |
| 327 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
| 328 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
| 327 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
| 328 | + return EEM_Registration::instance()->count(array($_where)); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | |
@@ -337,11 +337,11 @@ discard block |
||
| 337 | 337 | * @param \EE_Registration $item |
| 338 | 338 | * @return string |
| 339 | 339 | */ |
| 340 | - function column_cb($item){ |
|
| 340 | + function column_cb($item) { |
|
| 341 | 341 | /** checkbox/lock **/ |
| 342 | - $transaction = $item->get_first_related( 'Transaction' ); |
|
| 343 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
|
| 344 | - return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ); |
|
| 342 | + $transaction = $item->get_first_related('Transaction'); |
|
| 343 | + $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0; |
|
| 344 | + return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()).'<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | |
@@ -353,14 +353,14 @@ discard block |
||
| 353 | 353 | * @param \EE_Registration $item |
| 354 | 354 | * @return string |
| 355 | 355 | */ |
| 356 | - function column__REG_ID(EE_Registration $item){ |
|
| 356 | + function column__REG_ID(EE_Registration $item) { |
|
| 357 | 357 | $attendee = $item->attendee(); |
| 358 | 358 | $content = $item->ID(); |
| 359 | 359 | $content .= '<div class="show-on-mobile-view-only">'; |
| 360 | 360 | $content .= '<br>'; |
| 361 | 361 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
| 362 | - $content .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
| 363 | - $content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
| 362 | + $content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 363 | + $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
| 364 | 364 | $content .= '</div>'; |
| 365 | 365 | return $content; |
| 366 | 366 | } |
@@ -374,12 +374,12 @@ discard block |
||
| 374 | 374 | * @param \EE_Registration $item |
| 375 | 375 | * @return string |
| 376 | 376 | */ |
| 377 | - function column__REG_date(EE_Registration $item){ |
|
| 377 | + function column__REG_date(EE_Registration $item) { |
|
| 378 | 378 | $this->_set_related_details($item); |
| 379 | 379 | //Build row actions |
| 380 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
| 381 | - $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
| 382 | - $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
|
| 380 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL); |
|
| 381 | + $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
| 382 | + $view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>'; |
|
| 383 | 383 | return $view_link; |
| 384 | 384 | } |
| 385 | 385 | |
@@ -392,18 +392,18 @@ discard block |
||
| 392 | 392 | * @param \EE_Registration $item |
| 393 | 393 | * @return string |
| 394 | 394 | */ |
| 395 | - function column_event_name(EE_Registration $item){ |
|
| 396 | - $this->_set_related_details( $item ); |
|
| 395 | + function column_event_name(EE_Registration $item) { |
|
| 396 | + $this->_set_related_details($item); |
|
| 397 | 397 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
| 398 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL ); |
|
| 398 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL); |
|
| 399 | 399 | $event_name = $item->event_name(); |
| 400 | 400 | $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
| 401 | - $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ; |
|
| 401 | + $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'); |
|
| 402 | 402 | |
| 403 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
| 404 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' . __( 'View Registrations', 'event_espresso' ) . '</a>'; |
|
| 403 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
| 404 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>'; |
|
| 405 | 405 | |
| 406 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); |
|
| 406 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | |
@@ -415,18 +415,18 @@ discard block |
||
| 415 | 415 | * @param \EE_Registration $item |
| 416 | 416 | * @return string |
| 417 | 417 | */ |
| 418 | - function column_DTT_EVT_start(EE_Registration $item){ |
|
| 418 | + function column_DTT_EVT_start(EE_Registration $item) { |
|
| 419 | 419 | $datetime_strings = array(); |
| 420 | - $ticket = $item->ticket( TRUE ); |
|
| 421 | - if ( $ticket instanceof EE_Ticket ) { |
|
| 420 | + $ticket = $item->ticket(TRUE); |
|
| 421 | + if ($ticket instanceof EE_Ticket) { |
|
| 422 | 422 | $remove_defaults = array('default_where_conditions' => 'none'); |
| 423 | 423 | $datetimes = $ticket->datetimes($remove_defaults); |
| 424 | - foreach($datetimes as $datetime){ |
|
| 425 | - $datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
| 424 | + foreach ($datetimes as $datetime) { |
|
| 425 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
| 426 | 426 | } |
| 427 | - return implode("<br />",$datetime_strings); |
|
| 427 | + return implode("<br />", $datetime_strings); |
|
| 428 | 428 | } else { |
| 429 | - return __( 'There is no ticket on this registration', 'event_espresso' ); |
|
| 429 | + return __('There is no ticket on this registration', 'event_espresso'); |
|
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | |
@@ -439,45 +439,45 @@ discard block |
||
| 439 | 439 | * @param \EE_Registration $item |
| 440 | 440 | * @return string |
| 441 | 441 | */ |
| 442 | - function column_ATT_fname(EE_Registration $item){ |
|
| 442 | + function column_ATT_fname(EE_Registration $item) { |
|
| 443 | 443 | $attendee = $item->attendee(); |
| 444 | 444 | |
| 445 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
| 445 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
| 446 | 446 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
| 447 | - $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name; |
|
| 447 | + $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name; |
|
| 448 | 448 | $link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
| 449 | 449 | |
| 450 | 450 | $t = $item->get_first_related('Transaction'); |
| 451 | 451 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
| 452 | 452 | |
| 453 | 453 | //append group count to name |
| 454 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
| 454 | + $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 455 | 455 | |
| 456 | 456 | //append reg_code |
| 457 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
| 457 | + $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
| 458 | 458 | |
| 459 | 459 | //reg status text for accessibility |
| 460 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
| 460 | + $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
| 461 | 461 | |
| 462 | 462 | //trash/restore/delete actions |
| 463 | 463 | $actions = array(); |
| 464 | - if ( $this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) { |
|
| 465 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
| 466 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>'; |
|
| 467 | - } elseif ( $this->_view == 'trash' ) { |
|
| 464 | + if ($this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) { |
|
| 465 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
| 466 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
| 467 | + } elseif ($this->_view == 'trash') { |
|
| 468 | 468 | // restore registration link |
| 469 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) { |
|
| 470 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
| 471 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
| 469 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) { |
|
| 470 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
| 471 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
| 472 | 472 | } |
| 473 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) { |
|
| 474 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
| 473 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) { |
|
| 474 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
| 475 | 475 | |
| 476 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
| 476 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions) ); |
|
| 480 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | * @param \EE_Registration $item |
| 490 | 490 | * @return string |
| 491 | 491 | */ |
| 492 | - function column_ATT_email( EE_Registration $item ) { |
|
| 492 | + function column_ATT_email(EE_Registration $item) { |
|
| 493 | 493 | $attendee = $item->get_first_related('Attendee'); |
| 494 | 494 | return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email(); |
| 495 | 495 | } |
@@ -503,8 +503,8 @@ discard block |
||
| 503 | 503 | * @param \EE_Registration $item |
| 504 | 504 | * @return string |
| 505 | 505 | */ |
| 506 | - function column__REG_count(EE_Registration $item){ |
|
| 507 | - return sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size()); |
|
| 506 | + function column__REG_count(EE_Registration $item) { |
|
| 507 | + return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | |
@@ -516,16 +516,16 @@ discard block |
||
| 516 | 516 | * @param \EE_Registration $item |
| 517 | 517 | * @return string |
| 518 | 518 | */ |
| 519 | - function column_PRC_amount(EE_Registration $item){ |
|
| 519 | + function column_PRC_amount(EE_Registration $item) { |
|
| 520 | 520 | $ticket = $item->ticket(); |
| 521 | 521 | |
| 522 | - $content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : ''; |
|
| 522 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : ''; |
|
| 523 | 523 | |
| 524 | - if ( $item->final_price() > 0 ) { |
|
| 525 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
| 524 | + if ($item->final_price() > 0) { |
|
| 525 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
| 526 | 526 | } else { |
| 527 | 527 | // free event |
| 528 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
| 528 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>'; |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | return $content; |
@@ -541,11 +541,11 @@ discard block |
||
| 541 | 541 | * @param \EE_Registration $item |
| 542 | 542 | * @return string |
| 543 | 543 | */ |
| 544 | - function column__REG_final_price(EE_Registration $item){ |
|
| 544 | + function column__REG_final_price(EE_Registration $item) { |
|
| 545 | 545 | $ticket = $item->ticket(); |
| 546 | - $content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
| 546 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />'; |
|
| 547 | 547 | |
| 548 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
| 548 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
| 549 | 549 | return $content; |
| 550 | 550 | |
| 551 | 551 | } |
@@ -559,13 +559,13 @@ discard block |
||
| 559 | 559 | * @param \EE_Registration $item |
| 560 | 560 | * @return string |
| 561 | 561 | */ |
| 562 | - function column__REG_paid(EE_Registration $item){ |
|
| 562 | + function column__REG_paid(EE_Registration $item) { |
|
| 563 | 563 | $payment_method = $item->payment_method(); |
| 564 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
| 564 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
| 565 | 565 | |
| 566 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
| 567 | - if ( $item->paid() > 0 ) { |
|
| 568 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
| 566 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
| 567 | + if ($item->paid() > 0) { |
|
| 568 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
| 569 | 569 | } |
| 570 | 570 | return $content; |
| 571 | 571 | } |
@@ -579,11 +579,11 @@ discard block |
||
| 579 | 579 | * @param \EE_Registration $item |
| 580 | 580 | * @return string |
| 581 | 581 | */ |
| 582 | - function column_TXN_total(EE_Registration $item){ |
|
| 583 | - if($item->transaction()){ |
|
| 584 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
| 585 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
| 586 | - }else{ |
|
| 582 | + function column_TXN_total(EE_Registration $item) { |
|
| 583 | + if ($item->transaction()) { |
|
| 584 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
| 585 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
| 586 | + } else { |
|
| 587 | 587 | return __("None", "event_espresso"); |
| 588 | 588 | } |
| 589 | 589 | } |
@@ -597,15 +597,15 @@ discard block |
||
| 597 | 597 | * @param \EE_Registration $item |
| 598 | 598 | * @return string |
| 599 | 599 | */ |
| 600 | - function column_TXN_paid(EE_Registration $item){ |
|
| 600 | + function column_TXN_paid(EE_Registration $item) { |
|
| 601 | 601 | |
| 602 | - if ( $item->count() == 1 ) { |
|
| 602 | + if ($item->count() == 1) { |
|
| 603 | 603 | $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
| 604 | - if ( $transaction->paid() >= $transaction->total() ) { |
|
| 604 | + if ($transaction->paid() >= $transaction->total()) { |
|
| 605 | 605 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
| 606 | 606 | } else { |
| 607 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
| 608 | - return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
| 607 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
| 608 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | 611 | |
@@ -626,44 +626,44 @@ discard block |
||
| 626 | 626 | EE_Registry::instance()->load_helper('MSG_Template'); |
| 627 | 627 | $attendee = $item->attendee(); |
| 628 | 628 | $ticket = $item->ticket(); |
| 629 | - $this->_set_related_details( $item ); |
|
| 629 | + $this->_set_related_details($item); |
|
| 630 | 630 | |
| 631 | 631 | //Build row actions |
| 632 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
| 633 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL ); |
|
| 632 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
| 633 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL); |
|
| 634 | 634 | |
| 635 | 635 | // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
| 636 | 636 | //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
| 637 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true ); |
|
| 637 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true); |
|
| 638 | 638 | |
| 639 | 639 | |
| 640 | 640 | //Build row actions |
| 641 | - $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? ' |
|
| 641 | + $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? ' |
|
| 642 | 642 | <li> |
| 643 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
| 643 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
| 644 | 644 | <div class="dashicons dashicons-clipboard"></div> |
| 645 | 645 | </a> |
| 646 | 646 | </li>' : ''; |
| 647 | 647 | |
| 648 | - $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) && $attendee instanceof EE_Attendee ?' |
|
| 648 | + $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? ' |
|
| 649 | 649 | <li> |
| 650 | - <a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text"> |
|
| 650 | + <a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> |
|
| 651 | 651 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
| 652 | 652 | </a> |
| 653 | 653 | </li>' : ''; |
| 654 | 654 | |
| 655 | - $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? ' |
|
| 655 | + $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? ' |
|
| 656 | 656 | <li> |
| 657 | - <a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
| 657 | + <a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text"> |
|
| 658 | 658 | <div class="dashicons dashicons-email-alt"></div> |
| 659 | 659 | </a> |
| 660 | 660 | </li>' : ''; |
| 661 | 661 | |
| 662 | 662 | // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
| 663 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
| 664 | - $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? ' |
|
| 663 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL); |
|
| 664 | + $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? ' |
|
| 665 | 665 | <li> |
| 666 | - <a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_txn_lnk_url.'" title="' . $this->_transaction_details['title_attr'] . '" class="tiny-text"> |
|
| 666 | + <a class="ee-status-color-' . $this->_transaction_details['status'].'" href="'.$view_txn_lnk_url.'" title="'.$this->_transaction_details['title_attr'].'" class="tiny-text"> |
|
| 667 | 667 | <div class="dashicons dashicons-cart"></div> |
| 668 | 668 | </a> |
| 669 | 669 | </li>' : ''; |
@@ -671,10 +671,10 @@ discard block |
||
| 671 | 671 | //invoice link |
| 672 | 672 | $dl_invoice_lnk_url = $item->invoice_url(); |
| 673 | 673 | //only show invoice link if message type is active. |
| 674 | - if ( $item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
| 674 | + if ($item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
| 675 | 675 | $dl_invoice_lnk = ' |
| 676 | 676 | <li> |
| 677 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
| 677 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
| 678 | 678 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
| 679 | 679 | </a> |
| 680 | 680 | </li>'; |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | $dl_invoice_lnk = ''; |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | - return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul' ); |
|
| 685 | + return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul'); |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | } |
@@ -1,26 +1,26 @@ |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
| 2 | 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 | - * Event List |
|
| 17 | - * |
|
| 18 | - * @package Event Espresso |
|
| 19 | - * @subpackage /modules/events_archive/ |
|
| 20 | - * @author Brent Christensen |
|
| 21 | - * |
|
| 22 | - * ------------------------------------------------------------------------ |
|
| 23 | - */ |
|
| 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 | + * Event List |
|
| 17 | + * |
|
| 18 | + * @package Event Espresso |
|
| 19 | + * @subpackage /modules/events_archive/ |
|
| 20 | + * @author Brent Christensen |
|
| 21 | + * |
|
| 22 | + * ------------------------------------------------------------------------ |
|
| 23 | + */ |
|
| 24 | 24 | class EED_Events_Archive_Filters extends EED_Module { |
| 25 | 25 | |
| 26 | 26 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @return EED_Events_Archive |
| 44 | 44 | */ |
| 45 | 45 | public static function instance() { |
| 46 | - return parent::get_instance( __CLASS__ ); |
|
| 46 | + return parent::get_instance(__CLASS__); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | * @return void |
| 56 | 56 | */ |
| 57 | 57 | public static function set_hooks() { |
| 58 | - EE_Config::register_route( EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run' ); |
|
| 59 | - EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' ); |
|
| 60 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
| 58 | + EE_Config::register_route(EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run'); |
|
| 59 | + EE_Config::register_route('event_list', 'Events_Archive', 'event_list'); |
|
| 60 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @return void |
| 68 | 68 | */ |
| 69 | 69 | public static function set_hooks_admin() { |
| 70 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
| 70 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @return void |
| 81 | 81 | */ |
| 82 | 82 | public static function set_definitions() { |
| 83 | - define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
| 84 | - define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
| 83 | + define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
| 84 | + define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @return \EE_Events_Archive_Config |
| 93 | 93 | */ |
| 94 | - protected function set_config(){ |
|
| 95 | - $this->set_config_section( 'template_settings' ); |
|
| 96 | - $this->set_config_class( 'EE_Events_Archive_Config' ); |
|
| 97 | - $this->set_config_name( 'EED_Events_Archive' ); |
|
| 94 | + protected function set_config() { |
|
| 95 | + $this->set_config_section('template_settings'); |
|
| 96 | + $this->set_config_class('EE_Events_Archive_Config'); |
|
| 97 | + $this->set_config_name('EED_Events_Archive'); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
@@ -106,35 +106,35 @@ discard block |
||
| 106 | 106 | * @param \EE_Events_Archive_Config $config |
| 107 | 107 | * @return \EE_Template_Part_Manager |
| 108 | 108 | */ |
| 109 | - public function initialize_template_parts( EE_Events_Archive_Config $config = null ) { |
|
| 109 | + public function initialize_template_parts(EE_Events_Archive_Config $config = null) { |
|
| 110 | 110 | $config = $config instanceof EE_Events_Archive_Config ? $config : $this->config(); |
| 111 | 111 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
| 112 | 112 | $template_parts = new EE_Template_Part_Manager(); |
| 113 | 113 | $template_parts->add_template_part( |
| 114 | 114 | 'tickets', |
| 115 | - __( 'Ticket Selector', 'event_espresso' ), |
|
| 115 | + __('Ticket Selector', 'event_espresso'), |
|
| 116 | 116 | 'content-espresso_events-tickets.php', |
| 117 | 117 | $config->display_order_tickets |
| 118 | 118 | ); |
| 119 | 119 | $template_parts->add_template_part( |
| 120 | 120 | 'datetimes', |
| 121 | - __( 'Dates and Times', 'event_espresso' ), |
|
| 121 | + __('Dates and Times', 'event_espresso'), |
|
| 122 | 122 | 'content-espresso_events-datetimes.php', |
| 123 | 123 | $config->display_order_datetimes |
| 124 | 124 | ); |
| 125 | 125 | $template_parts->add_template_part( |
| 126 | 126 | 'event', |
| 127 | - __( 'Event Description', 'event_espresso' ), |
|
| 127 | + __('Event Description', 'event_espresso'), |
|
| 128 | 128 | 'content-espresso_events-details.php', |
| 129 | 129 | $config->display_order_event |
| 130 | 130 | ); |
| 131 | 131 | $template_parts->add_template_part( |
| 132 | 132 | 'venue', |
| 133 | - __( 'Venue Information', 'event_espresso' ), |
|
| 133 | + __('Venue Information', 'event_espresso'), |
|
| 134 | 134 | 'content-espresso_events-venues.php', |
| 135 | 135 | $config->display_order_venue |
| 136 | 136 | ); |
| 137 | - do_action( 'AHEE__EED_Event_Archive__initialize_template_parts', $template_parts ); |
|
| 137 | + do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts); |
|
| 138 | 138 | return $template_parts; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | * @param WP $WP |
| 148 | 148 | * @return void |
| 149 | 149 | */ |
| 150 | - public function run( $WP ) { |
|
| 151 | - do_action( 'AHEE__EED_Events_Archive__before_run' ); |
|
| 150 | + public function run($WP) { |
|
| 151 | + do_action('AHEE__EED_Events_Archive__before_run'); |
|
| 152 | 152 | // ensure valid EE_Events_Archive_Config() object exists |
| 153 | 153 | $this->set_config(); |
| 154 | 154 | /** @type EE_Events_Archive_Config $config */ |
@@ -156,19 +156,19 @@ discard block |
||
| 156 | 156 | // load other required components |
| 157 | 157 | $this->load_event_list_assets(); |
| 158 | 158 | // filter the WP posts_join, posts_where, and posts_orderby SQL clauses |
| 159 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 159 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 160 | 160 | //add query filters |
| 161 | 161 | EEH_Event_Query::add_query_filters(); |
| 162 | 162 | // set params that will get used by the filters |
| 163 | 163 | EEH_Event_Query::set_query_params( |
| 164 | - '', // month |
|
| 165 | - '', // category |
|
| 166 | - $config->display_expired_events, // show_expired |
|
| 167 | - 'start_date', // orderby |
|
| 164 | + '', // month |
|
| 165 | + '', // category |
|
| 166 | + $config->display_expired_events, // show_expired |
|
| 167 | + 'start_date', // orderby |
|
| 168 | 168 | 'ASC' // sort |
| 169 | 169 | ); |
| 170 | 170 | // check what template is loaded |
| 171 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
| 171 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
@@ -200,32 +200,32 @@ discard block |
||
| 200 | 200 | * @param string $template |
| 201 | 201 | * @return string |
| 202 | 202 | */ |
| 203 | - public function template_include( $template = '' ) { |
|
| 203 | + public function template_include($template = '') { |
|
| 204 | 204 | // don't add content filter for dedicated EE child themes or private posts |
| 205 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 206 | - if ( ! EEH_Template::is_espresso_theme() ) { |
|
| 205 | + EE_Registry::instance()->load_helper('Template'); |
|
| 206 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
| 207 | 207 | /** @type EE_Events_Archive_Config $config */ |
| 208 | 208 | $config = $this->config(); |
| 209 | 209 | // add status banner ? |
| 210 | - if ( $config->display_status_banner ) { |
|
| 211 | - add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
| 210 | + if ($config->display_status_banner) { |
|
| 211 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
| 212 | 212 | } |
| 213 | 213 | // if NOT a custom template |
| 214 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' |
|
| 215 | - || apply_filters( 'FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', FALSE ) |
|
| 214 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' |
|
| 215 | + || apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', FALSE) |
|
| 216 | 216 | ) { |
| 217 | 217 | // don't display entry meta because the existing theme will take care of that |
| 218 | - add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' ); |
|
| 218 | + add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true'); |
|
| 219 | 219 | // load functions.php file for the theme (loaded by WP if using child theme) |
| 220 | 220 | EEH_Template::load_espresso_theme_functions(); |
| 221 | 221 | // because we don't know if the theme is using the_excerpt() |
| 222 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 222 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 223 | 223 | // or the_content |
| 224 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 224 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 225 | 225 | // and just in case they are running get_the_excerpt() which DESTROYS things |
| 226 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
| 226 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
| 227 | 227 | // don't display entry meta because the existing theme will take care of that |
| 228 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
| 228 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | return $template; |
@@ -240,17 +240,17 @@ discard block |
||
| 240 | 240 | * @param string $excerpt |
| 241 | 241 | * @return string |
| 242 | 242 | */ |
| 243 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
| 244 | - if ( post_password_required() ) { |
|
| 243 | + public static function get_the_excerpt($excerpt = '') { |
|
| 244 | + if (post_password_required()) { |
|
| 245 | 245 | return $excerpt; |
| 246 | 246 | } |
| 247 | - if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) { |
|
| 248 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
| 249 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
| 250 | - $excerpt = EED_Events_Archive::event_details( $excerpt ); |
|
| 247 | + if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) { |
|
| 248 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
| 249 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
| 250 | + $excerpt = EED_Events_Archive::event_details($excerpt); |
|
| 251 | 251 | } else { |
| 252 | 252 | EED_Events_Archive::$using_get_the_excerpt = true; |
| 253 | - add_filter( 'wp_trim_excerpt', array( 'EED_Events_Archive', 'end_get_the_excerpt' ), 999, 1 ); |
|
| 253 | + add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1); |
|
| 254 | 254 | } |
| 255 | 255 | return $excerpt; |
| 256 | 256 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @param string $text |
| 265 | 265 | * @return string |
| 266 | 266 | */ |
| 267 | - public static function end_get_the_excerpt( $text = '' ) { |
|
| 267 | + public static function end_get_the_excerpt($text = '') { |
|
| 268 | 268 | EED_Events_Archive::$using_get_the_excerpt = false; |
| 269 | 269 | return $text; |
| 270 | 270 | } |
@@ -279,10 +279,10 @@ discard block |
||
| 279 | 279 | * @param string $id |
| 280 | 280 | * @return string |
| 281 | 281 | */ |
| 282 | - public static function the_title( $title = '', $id = '' ) { |
|
| 282 | + public static function the_title($title = '', $id = '') { |
|
| 283 | 283 | global $post; |
| 284 | - if ( $post instanceof WP_Post ) { |
|
| 285 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
| 284 | + if ($post instanceof WP_Post) { |
|
| 285 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
| 286 | 286 | } |
| 287 | 287 | return $title; |
| 288 | 288 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * @param string $content |
| 297 | 297 | * @return string |
| 298 | 298 | */ |
| 299 | - public static function event_details( $content ) { |
|
| 299 | + public static function event_details($content) { |
|
| 300 | 300 | global $post; |
| 301 | 301 | static $current_post_ID = 0; |
| 302 | 302 | if ( |
@@ -305,8 +305,8 @@ discard block |
||
| 305 | 305 | && ! EED_Events_Archive::$using_get_the_excerpt |
| 306 | 306 | && ! post_password_required() |
| 307 | 307 | && ( |
| 308 | - apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', false ) |
|
| 309 | - || ! apply_filters( 'FHEE__content_espresso_events__template_loaded', false ) |
|
| 308 | + apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false) |
|
| 309 | + || ! apply_filters('FHEE__content_espresso_events__template_loaded', false) |
|
| 310 | 310 | ) |
| 311 | 311 | ) { |
| 312 | 312 | // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
@@ -315,8 +315,8 @@ discard block |
||
| 315 | 315 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
| 316 | 316 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
| 317 | 317 | // so the following allows this filter to be applied multiple times, but only once for real |
| 318 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
| 319 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order ) { |
|
| 318 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
| 319 | + if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) { |
|
| 320 | 320 | $content = \EED_Events_Archive::use_sortable_display_order(); |
| 321 | 321 | } else { |
| 322 | 322 | $content = \EED_Events_Archive::use_filterable_display_order(); |
@@ -335,20 +335,20 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | protected static function use_sortable_display_order() { |
| 337 | 337 | // no further password checks required atm |
| 338 | - add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
| 338 | + add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
| 339 | 339 | // we need to first remove this callback from being applied to the_content() or the_excerpt() (otherwise it will recurse and blow up the interweb) |
| 340 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
| 341 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
| 342 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
| 340 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
| 341 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
| 342 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
| 343 | 343 | // now add additional content depending on whether event is using the_excerpt() or the_content() |
| 344 | 344 | EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts(); |
| 345 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
| 346 | - $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content ); |
|
| 345 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
| 346 | + $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content); |
|
| 347 | 347 | // re-add our main filters (or else the next event won't have them) |
| 348 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 349 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 350 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
| 351 | - remove_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
| 348 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 349 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 350 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
| 351 | + remove_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
| 352 | 352 | return $content; |
| 353 | 353 | } |
| 354 | 354 | |
@@ -363,22 +363,22 @@ discard block |
||
| 363 | 363 | protected static function use_filterable_display_order() { |
| 364 | 364 | // we need to first remove this callback from being applied to the_content() |
| 365 | 365 | // (otherwise it will recurse and blow up the interweb) |
| 366 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
| 367 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
| 368 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
| 366 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
| 367 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
| 368 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
| 369 | 369 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
| 370 | 370 | EED_Events_Archive::_add_additional_excerpt_filters(); |
| 371 | 371 | EED_Events_Archive::_add_additional_content_filters(); |
| 372 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters' ); |
|
| 372 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters'); |
|
| 373 | 373 | // now load our template |
| 374 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
| 374 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
| 375 | 375 | // re-add our main filters (or else the next event won't have them) |
| 376 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 377 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 378 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
| 376 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 377 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 378 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
| 379 | 379 | // but remove the other filters so that they don't get applied to the next post |
| 380 | 380 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
| 381 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters' ); |
|
| 381 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters'); |
|
| 382 | 382 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
| 383 | 383 | //return ! empty( $template ) ? $template : $content; |
| 384 | 384 | return $content; |
@@ -393,11 +393,11 @@ discard block |
||
| 393 | 393 | * @param string $content |
| 394 | 394 | * @return string |
| 395 | 395 | */ |
| 396 | - public static function event_datetimes( $content ) { |
|
| 397 | - if ( post_password_required() ) { |
|
| 396 | + public static function event_datetimes($content) { |
|
| 397 | + if (post_password_required()) { |
|
| 398 | 398 | return $content; |
| 399 | 399 | } |
| 400 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
| 400 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | /** |
@@ -407,11 +407,11 @@ discard block |
||
| 407 | 407 | * @param string $content |
| 408 | 408 | * @return string |
| 409 | 409 | */ |
| 410 | - public static function event_tickets( $content ) { |
|
| 411 | - if ( post_password_required() ) { |
|
| 410 | + public static function event_tickets($content) { |
|
| 411 | + if (post_password_required()) { |
|
| 412 | 412 | return $content; |
| 413 | 413 | } |
| 414 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
| 414 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | |
@@ -423,8 +423,8 @@ discard block |
||
| 423 | 423 | * @param string $content |
| 424 | 424 | * @return string |
| 425 | 425 | */ |
| 426 | - public static function event_venue( $content ) { |
|
| 427 | - return EED_Events_Archive::event_venues( $content ); |
|
| 426 | + public static function event_venue($content) { |
|
| 427 | + return EED_Events_Archive::event_venues($content); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | /** |
@@ -434,11 +434,11 @@ discard block |
||
| 434 | 434 | * @param string $content |
| 435 | 435 | * @return string |
| 436 | 436 | */ |
| 437 | - public static function event_venues( $content ) { |
|
| 438 | - if ( post_password_required() ) { |
|
| 437 | + public static function event_venues($content) { |
|
| 438 | + if (post_password_required()) { |
|
| 439 | 439 | return $content; |
| 440 | 440 | } |
| 441 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
| 441 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | |
@@ -450,9 +450,9 @@ discard block |
||
| 450 | 450 | * @return void |
| 451 | 451 | */ |
| 452 | 452 | private static function _add_additional_excerpt_filters() { |
| 453 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
| 454 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
| 455 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
| 453 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
| 454 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
| 455 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | |
@@ -464,9 +464,9 @@ discard block |
||
| 464 | 464 | * @return void |
| 465 | 465 | */ |
| 466 | 466 | private static function _add_additional_content_filters() { |
| 467 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
| 468 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
| 469 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
| 467 | + add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
| 468 | + add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
| 469 | + add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | |
@@ -478,12 +478,12 @@ discard block |
||
| 478 | 478 | * @return void |
| 479 | 479 | */ |
| 480 | 480 | private static function _remove_additional_events_archive_filters() { |
| 481 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
| 482 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
| 483 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
| 484 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
| 485 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
| 486 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
| 481 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
| 482 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
| 483 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
| 484 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
| 485 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
| 486 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | |
@@ -496,17 +496,17 @@ discard block |
||
| 496 | 496 | */ |
| 497 | 497 | public static function remove_all_events_archive_filters() { |
| 498 | 498 | //remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
| 499 | - remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100 ); |
|
| 500 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
| 501 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
| 502 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
| 503 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
| 504 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
| 505 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
| 506 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
| 507 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
| 499 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100); |
|
| 500 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
| 501 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
| 502 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
| 503 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
| 504 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
| 505 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
| 506 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
| 507 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
| 508 | 508 | // don't display entry meta because the existing theme will take care of that |
| 509 | - remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
| 509 | + remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | |
@@ -521,15 +521,15 @@ discard block |
||
| 521 | 521 | * @return void |
| 522 | 522 | */ |
| 523 | 523 | public function load_event_list_assets() { |
| 524 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
| 525 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
| 526 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
| 527 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
| 528 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
| 529 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
| 530 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
| 524 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
| 525 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
| 526 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
| 527 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
| 528 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
| 529 | + EE_Registry::instance()->load_helper('Maps'); |
|
| 530 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
| 531 | 531 | } |
| 532 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
| 532 | + EE_Registry::instance()->load_helper('Event_View'); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | |
@@ -545,14 +545,14 @@ discard block |
||
| 545 | 545 | */ |
| 546 | 546 | public function wp_enqueue_scripts() { |
| 547 | 547 | // get some style |
| 548 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
| 548 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
| 549 | 549 | // first check uploads folder |
| 550 | - EE_Registry::instance()->load_helper( 'File' ); |
|
| 551 | - if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
| 552 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
| 550 | + EE_Registry::instance()->load_helper('File'); |
|
| 551 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
| 552 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
| 553 | 553 | } else { |
| 554 | 554 | } |
| 555 | - wp_enqueue_style( $this->theme ); |
|
| 555 | + wp_enqueue_style($this->theme); |
|
| 556 | 556 | |
| 557 | 557 | } |
| 558 | 558 | } |
@@ -570,8 +570,8 @@ discard block |
||
| 570 | 570 | */ |
| 571 | 571 | public static function template_settings_form() { |
| 572 | 572 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
| 573 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
| 574 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
| 573 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
| 574 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
| 575 | 575 | $events_archive_settings = array( |
| 576 | 576 | 'display_status_banner' => 0, |
| 577 | 577 | 'display_description' => 1, |
@@ -580,8 +580,8 @@ discard block |
||
| 580 | 580 | 'display_venue' => 0, |
| 581 | 581 | 'display_expired_events' => 0 |
| 582 | 582 | ); |
| 583 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
| 584 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
| 583 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
| 584 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | |
@@ -597,16 +597,16 @@ discard block |
||
| 597 | 597 | * @param EE_Request_Handler $REQ |
| 598 | 598 | * @return EE_Template_Config |
| 599 | 599 | */ |
| 600 | - public static function update_template_settings( $CFG, $REQ ) { |
|
| 600 | + public static function update_template_settings($CFG, $REQ) { |
|
| 601 | 601 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
| 602 | 602 | // unless we are resetting the config... |
| 603 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
| 604 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
| 605 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
| 606 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
| 607 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
| 608 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
| 609 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
| 603 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
| 604 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
| 605 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
| 606 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
| 607 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
| 608 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
| 609 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
| 610 | 610 | return $CFG; |
| 611 | 611 | } |
| 612 | 612 | |
@@ -619,10 +619,10 @@ discard block |
||
| 619 | 619 | * @param string $extra_class |
| 620 | 620 | * @return string |
| 621 | 621 | */ |
| 622 | - public static function event_list_css( $extra_class = '' ) { |
|
| 623 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
| 622 | + public static function event_list_css($extra_class = '') { |
|
| 623 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
| 624 | 624 | $event_list_css[] = 'espresso-event-list-event'; |
| 625 | - return implode( ' ', $event_list_css ); |
|
| 625 | + return implode(' ', $event_list_css); |
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | |
@@ -649,9 +649,9 @@ discard block |
||
| 649 | 649 | * @param $value |
| 650 | 650 | * @return bool |
| 651 | 651 | */ |
| 652 | - public static function display_description( $value ) { |
|
| 652 | + public static function display_description($value) { |
|
| 653 | 653 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
| 654 | - $display_description= isset( $config->display_description ) ? $config->display_description : 1; |
|
| 654 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
| 655 | 655 | return $display_description === $value ? TRUE : FALSE; |
| 656 | 656 | } |
| 657 | 657 | |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | */ |
| 665 | 665 | public static function display_ticket_selector() { |
| 666 | 666 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
| 667 | - return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE; |
|
| 667 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE; |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | |
@@ -676,9 +676,9 @@ discard block |
||
| 676 | 676 | * @return bool |
| 677 | 677 | */ |
| 678 | 678 | public static function display_venue() { |
| 679 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
| 679 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
| 680 | 680 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
| 681 | - return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
| 681 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | */ |
| 691 | 691 | public static function display_datetimes() { |
| 692 | 692 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
| 693 | - return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE; |
|
| 693 | + return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE; |
|
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | * @return string |
| 706 | 706 | */ |
| 707 | 707 | public static function event_list_title() { |
| 708 | - return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
| 708 | + return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | |
@@ -714,11 +714,11 @@ discard block |
||
| 714 | 714 | /** |
| 715 | 715 | * @since 4.4.0 |
| 716 | 716 | */ |
| 717 | - public static function _doing_it_wrong_notice( $function = '' ) { |
|
| 717 | + public static function _doing_it_wrong_notice($function = '') { |
|
| 718 | 718 | EE_Error::doing_it_wrong( |
| 719 | 719 | __FUNCTION__, |
| 720 | 720 | sprintf( |
| 721 | - __( 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso' ), |
|
| 721 | + __('EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso'), |
|
| 722 | 722 | $function, |
| 723 | 723 | '<br />', |
| 724 | 724 | '4.6.0' |
@@ -734,107 +734,107 @@ discard block |
||
| 734 | 734 | * @since 4.4.0 |
| 735 | 735 | */ |
| 736 | 736 | public function get_post_data() { |
| 737 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 737 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 738 | 738 | EEH_Event_Query::set_query_params(); |
| 739 | 739 | } |
| 740 | 740 | /** |
| 741 | 741 | * @deprecated |
| 742 | 742 | * @since 4.4.0 |
| 743 | 743 | */ |
| 744 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
| 745 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 746 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 747 | - return EEH_Event_Query::posts_fields( $SQL, $wp_query ); |
|
| 744 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
| 745 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 746 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 747 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
| 748 | 748 | } |
| 749 | 749 | /** |
| 750 | 750 | * @deprecated |
| 751 | 751 | * @since 4.4.0 |
| 752 | 752 | */ |
| 753 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
| 754 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 755 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 756 | - return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params ); |
|
| 753 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
| 754 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 755 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 756 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
| 757 | 757 | } |
| 758 | 758 | /** |
| 759 | 759 | * @deprecated |
| 760 | 760 | * @since 4.4.0 |
| 761 | 761 | */ |
| 762 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
| 763 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 764 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 765 | - return EEH_Event_Query::posts_join( $SQL, $wp_query ); |
|
| 762 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
| 763 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 764 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 765 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
| 766 | 766 | } |
| 767 | 767 | /** |
| 768 | 768 | * @deprecated |
| 769 | 769 | * @since 4.4.0 |
| 770 | 770 | */ |
| 771 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
| 772 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 773 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 774 | - return EEH_Event_Query::posts_join_sql_for_terms( $join_terms ); |
|
| 771 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
| 772 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 773 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 774 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
| 775 | 775 | } |
| 776 | 776 | /** |
| 777 | 777 | * @deprecated |
| 778 | 778 | * @since 4.4.0 |
| 779 | 779 | */ |
| 780 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
| 781 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 782 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 783 | - return EEH_Event_Query::posts_join_for_orderby( $orderby_params ); |
|
| 780 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
| 781 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 782 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 783 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
| 784 | 784 | } |
| 785 | 785 | /** |
| 786 | 786 | * @deprecated |
| 787 | 787 | * @since 4.4.0 |
| 788 | 788 | */ |
| 789 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
| 790 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 791 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 792 | - return EEH_Event_Query::posts_where( $SQL, $wp_query ); |
|
| 789 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
| 790 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 791 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 792 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
| 793 | 793 | } |
| 794 | 794 | /** |
| 795 | 795 | * @deprecated |
| 796 | 796 | * @since 4.4.0 |
| 797 | 797 | */ |
| 798 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
| 799 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 800 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 801 | - return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired ); |
|
| 798 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
| 799 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 800 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 801 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
| 802 | 802 | } |
| 803 | 803 | /** |
| 804 | 804 | * @deprecated |
| 805 | 805 | * @since 4.4.0 |
| 806 | 806 | */ |
| 807 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
| 808 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 809 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 810 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug ); |
|
| 807 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
| 808 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 809 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 810 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
| 811 | 811 | } |
| 812 | 812 | /** |
| 813 | 813 | * @deprecated |
| 814 | 814 | * @since 4.4.0 |
| 815 | 815 | */ |
| 816 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
| 817 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 818 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 819 | - return EEH_Event_Query::posts_where_sql_for_event_list_month( $month ); |
|
| 816 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
| 817 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 818 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 819 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
| 820 | 820 | } |
| 821 | 821 | /** |
| 822 | 822 | * @deprecated |
| 823 | 823 | * @since 4.4.0 |
| 824 | 824 | */ |
| 825 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
| 826 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 827 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 828 | - return EEH_Event_Query::posts_orderby( $SQL, $wp_query ); |
|
| 825 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
| 826 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 827 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 828 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
| 829 | 829 | } |
| 830 | 830 | /** |
| 831 | 831 | * @deprecated |
| 832 | 832 | * @since 4.4.0 |
| 833 | 833 | */ |
| 834 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
| 835 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 836 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 837 | - return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort ); |
|
| 834 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
| 835 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 836 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 837 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | |
@@ -865,8 +865,8 @@ discard block |
||
| 865 | 865 | * @param string $extra_class |
| 866 | 866 | * @return string |
| 867 | 867 | */ |
| 868 | -function espresso_event_list_css( $extra_class = '' ) { |
|
| 869 | - return EED_Events_Archive::event_list_css( $extra_class ); |
|
| 868 | +function espresso_event_list_css($extra_class = '') { |
|
| 869 | + return EED_Events_Archive::event_list_css($extra_class); |
|
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | /** |
@@ -880,14 +880,14 @@ discard block |
||
| 880 | 880 | * @return bool |
| 881 | 881 | */ |
| 882 | 882 | function espresso_display_full_description_in_event_list() { |
| 883 | - return EED_Events_Archive::display_description( 2 ); |
|
| 883 | + return EED_Events_Archive::display_description(2); |
|
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | /** |
| 887 | 887 | * @return bool |
| 888 | 888 | */ |
| 889 | 889 | function espresso_display_excerpt_in_event_list() { |
| 890 | - return EED_Events_Archive::display_description( 1 ); |
|
| 890 | + return EED_Events_Archive::display_description(1); |
|
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | /** |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @return EED_Event_Single |
| 41 | 41 | */ |
| 42 | 42 | public static function instance() { |
| 43 | - return parent::get_instance( __CLASS__ ); |
|
| 43 | + return parent::get_instance(__CLASS__); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * @return void |
| 53 | 53 | */ |
| 54 | 54 | public static function set_hooks() { |
| 55 | - add_filter( 'FHEE_run_EE_wp', '__return_true' ); |
|
| 56 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
| 57 | - EE_Config::register_route( __( 'event', 'event_espresso' ), 'Event_Single', 'run' ); |
|
| 55 | + add_filter('FHEE_run_EE_wp', '__return_true'); |
|
| 56 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
| 57 | + EE_Config::register_route(__('event', 'event_espresso'), 'Event_Single', 'run'); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | 66 | public static function set_hooks_admin() { |
| 67 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
| 67 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * @return void |
| 79 | 79 | */ |
| 80 | 80 | public static function set_definitions() { |
| 81 | - define( 'EVENT_SINGLE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
| 82 | - define( 'EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
| 81 | + define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
| 82 | + define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @void |
| 91 | 91 | */ |
| 92 | - protected function set_config(){ |
|
| 93 | - $this->set_config_section( 'template_settings' ); |
|
| 94 | - $this->set_config_class( 'EE_Event_Single_Config' ); |
|
| 95 | - $this->set_config_name( 'EED_Event_Single' ); |
|
| 92 | + protected function set_config() { |
|
| 93 | + $this->set_config_section('template_settings'); |
|
| 94 | + $this->set_config_class('EE_Event_Single_Config'); |
|
| 95 | + $this->set_config_name('EED_Event_Single'); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
@@ -105,35 +105,35 @@ discard block |
||
| 105 | 105 | * @param \EE_Event_Single_Config $config |
| 106 | 106 | * @return \EE_Template_Part_Manager |
| 107 | 107 | */ |
| 108 | - public function initialize_template_parts( EE_Event_Single_Config $config = null ) { |
|
| 108 | + public function initialize_template_parts(EE_Event_Single_Config $config = null) { |
|
| 109 | 109 | $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
| 110 | 110 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
| 111 | 111 | $template_parts = new EE_Template_Part_Manager(); |
| 112 | 112 | $template_parts->add_template_part( |
| 113 | 113 | 'tickets', |
| 114 | - __( 'Ticket Selector', 'event_espresso' ), |
|
| 114 | + __('Ticket Selector', 'event_espresso'), |
|
| 115 | 115 | 'content-espresso_events-tickets.php', |
| 116 | 116 | $config->display_order_tickets |
| 117 | 117 | ); |
| 118 | 118 | $template_parts->add_template_part( |
| 119 | 119 | 'datetimes', |
| 120 | - __( 'Dates and Times', 'event_espresso' ), |
|
| 120 | + __('Dates and Times', 'event_espresso'), |
|
| 121 | 121 | 'content-espresso_events-datetimes.php', |
| 122 | 122 | $config->display_order_datetimes |
| 123 | 123 | ); |
| 124 | 124 | $template_parts->add_template_part( |
| 125 | 125 | 'event', |
| 126 | - __( 'Event Description', 'event_espresso' ), |
|
| 126 | + __('Event Description', 'event_espresso'), |
|
| 127 | 127 | 'content-espresso_events-details.php', |
| 128 | 128 | $config->display_order_event |
| 129 | 129 | ); |
| 130 | 130 | $template_parts->add_template_part( |
| 131 | 131 | 'venue', |
| 132 | - __( 'Venue Information', 'event_espresso' ), |
|
| 132 | + __('Venue Information', 'event_espresso'), |
|
| 133 | 133 | 'content-espresso_events-venues.php', |
| 134 | 134 | $config->display_order_venue |
| 135 | 135 | ); |
| 136 | - do_action( 'AHEE__EED_Event_Single__initialize_template_parts', $template_parts ); |
|
| 136 | + do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
| 137 | 137 | return $template_parts; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -147,15 +147,15 @@ discard block |
||
| 147 | 147 | * @param WP $WP |
| 148 | 148 | * @return void |
| 149 | 149 | */ |
| 150 | - public function run( $WP ) { |
|
| 150 | + public function run($WP) { |
|
| 151 | 151 | // ensure valid EE_Events_Single_Config() object exists |
| 152 | 152 | $this->set_config(); |
| 153 | 153 | // check what template is loaded |
| 154 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
| 155 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
| 154 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
| 155 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
| 156 | 156 | // load css |
| 157 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
| 158 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
| 157 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
| 158 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | |
@@ -167,27 +167,27 @@ discard block |
||
| 167 | 167 | * @param string $template |
| 168 | 168 | * @return string |
| 169 | 169 | */ |
| 170 | - public function template_include( $template ) { |
|
| 170 | + public function template_include($template) { |
|
| 171 | 171 | global $post; |
| 172 | 172 | /** @type EE_Event_Single_Config $config */ |
| 173 | 173 | $config = $this->config(); |
| 174 | - if ( $config->display_status_banner_single ) { |
|
| 175 | - add_filter( 'the_title', array( 'EED_Event_Single', 'the_title' ), 100, 2 ); |
|
| 174 | + if ($config->display_status_banner_single) { |
|
| 175 | + add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
| 176 | 176 | } |
| 177 | 177 | // not a custom template? |
| 178 | 178 | if ( |
| 179 | 179 | EE_Front_Controller::instance()->get_selected_template() != 'single-espresso_events.php' |
| 180 | - || apply_filters( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', FALSE ) |
|
| 181 | - && ! post_password_required( $post ) |
|
| 180 | + || apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', FALSE) |
|
| 181 | + && ! post_password_required($post) |
|
| 182 | 182 | ) { |
| 183 | 183 | EEH_Template::load_espresso_theme_functions(); |
| 184 | 184 | // then add extra event data via hooks |
| 185 | - add_action( 'loop_start', array( 'EED_Event_Single', 'loop_start' )); |
|
| 186 | - add_filter( 'get_the_excerpt', array( 'EED_Event_Single', 'get_the_excerpt' ), 1, 1 ); |
|
| 187 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
| 188 | - add_action( 'loop_end', array( 'EED_Event_Single', 'loop_end' )); |
|
| 185 | + add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
| 186 | + add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
| 187 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
| 188 | + add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
| 189 | 189 | // don't display entry meta because the existing theme will take car of that |
| 190 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
| 190 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
| 191 | 191 | } |
| 192 | 192 | return $template; |
| 193 | 193 | } |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | * @param array $wp_query_array an array containing the WP_Query object |
| 202 | 202 | * @return void |
| 203 | 203 | */ |
| 204 | - public static function loop_start( $wp_query_array ) { |
|
| 204 | + public static function loop_start($wp_query_array) { |
|
| 205 | 205 | global $post; |
| 206 | - do_action( 'AHEE_event_details_before_post', $post, $wp_query_array ); |
|
| 206 | + do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | |
@@ -216,9 +216,9 @@ discard block |
||
| 216 | 216 | * @param int $id |
| 217 | 217 | * @return string |
| 218 | 218 | */ |
| 219 | - public static function the_title( $title = '', $id = 0 ) { |
|
| 219 | + public static function the_title($title = '', $id = 0) { |
|
| 220 | 220 | global $post; |
| 221 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
| 221 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | |
@@ -230,9 +230,9 @@ discard block |
||
| 230 | 230 | * @param string $excerpt |
| 231 | 231 | * @return string |
| 232 | 232 | */ |
| 233 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
| 233 | + public static function get_the_excerpt($excerpt = '') { |
|
| 234 | 234 | EED_Event_Single::$using_get_the_excerpt = true; |
| 235 | - add_filter( 'wp_trim_excerpt', array( 'EED_Event_Single', 'end_get_the_excerpt' ), 999, 1 ); |
|
| 235 | + add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
| 236 | 236 | return $excerpt; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @param string $text |
| 246 | 246 | * @return string |
| 247 | 247 | */ |
| 248 | - public static function end_get_the_excerpt( $text = '' ) { |
|
| 248 | + public static function end_get_the_excerpt($text = '') { |
|
| 249 | 249 | EED_Event_Single::$using_get_the_excerpt = false; |
| 250 | 250 | return $text; |
| 251 | 251 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | * @param string $content |
| 260 | 260 | * @return string |
| 261 | 261 | */ |
| 262 | - public static function event_details( $content ) { |
|
| 262 | + public static function event_details($content) { |
|
| 263 | 263 | global $post; |
| 264 | 264 | static $current_post_ID = 0; |
| 265 | 265 | if ( |
@@ -274,15 +274,15 @@ discard block |
||
| 274 | 274 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
| 275 | 275 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
| 276 | 276 | // so the following allows this filter to be applied multiple times, but only once for real |
| 277 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
| 278 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order ) { |
|
| 277 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
| 278 | + if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
| 279 | 279 | // we need to first remove this callback from being applied to the_content() |
| 280 | 280 | // (otherwise it will recurse and blow up the interweb) |
| 281 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
| 281 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
| 282 | 282 | EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(); |
| 283 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
| 284 | - $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters( $content ); |
|
| 285 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
| 283 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
| 284 | + $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
| 285 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
| 286 | 286 | } else { |
| 287 | 287 | $content = EED_Event_Single::use_filterable_display_order(); |
| 288 | 288 | } |
@@ -303,19 +303,19 @@ discard block |
||
| 303 | 303 | // it uses the_content() for displaying the $post->post_content |
| 304 | 304 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
| 305 | 305 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
| 306 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
| 306 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
| 307 | 307 | //now add additional content |
| 308 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110, 1 ); |
|
| 309 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120, 1 ); |
|
| 310 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130, 1 ); |
|
| 311 | - do_action( 'AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters' ); |
|
| 308 | + add_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110, 1); |
|
| 309 | + add_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120, 1); |
|
| 310 | + add_filter('the_content', array('EED_Event_Single', 'event_venues'), 130, 1); |
|
| 311 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
| 312 | 312 | // now load our template |
| 313 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
| 313 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
| 314 | 314 | //now add our filter back in, plus some others |
| 315 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
| 316 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110 ); |
|
| 317 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 ); |
|
| 318 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130 ); |
|
| 315 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
| 316 | + remove_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110); |
|
| 317 | + remove_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120); |
|
| 318 | + remove_filter('the_content', array('EED_Event_Single', 'event_venues'), 130); |
|
| 319 | 319 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
| 320 | 320 | return $content; |
| 321 | 321 | } |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | * @param string $content |
| 330 | 330 | * @return string |
| 331 | 331 | */ |
| 332 | - public static function event_datetimes( $content ) { |
|
| 333 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
| 332 | + public static function event_datetimes($content) { |
|
| 333 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | |
@@ -342,8 +342,8 @@ discard block |
||
| 342 | 342 | * @param string $content |
| 343 | 343 | * @return string |
| 344 | 344 | */ |
| 345 | - public static function event_tickets( $content ) { |
|
| 346 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
| 345 | + public static function event_tickets($content) { |
|
| 346 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | |
@@ -355,8 +355,8 @@ discard block |
||
| 355 | 355 | * @param string $content |
| 356 | 356 | * @return string |
| 357 | 357 | */ |
| 358 | - public static function event_venue( $content ) { |
|
| 359 | - return EED_Event_Single::event_venues( $content ); |
|
| 358 | + public static function event_venue($content) { |
|
| 359 | + return EED_Event_Single::event_venues($content); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | |
@@ -368,8 +368,8 @@ discard block |
||
| 368 | 368 | * @param string $content |
| 369 | 369 | * @return string |
| 370 | 370 | */ |
| 371 | - public static function event_venues( $content ) { |
|
| 372 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
| 371 | + public static function event_venues($content) { |
|
| 372 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | |
@@ -381,9 +381,9 @@ discard block |
||
| 381 | 381 | * @param array $wp_query_array an array containing the WP_Query object |
| 382 | 382 | * @return void |
| 383 | 383 | */ |
| 384 | - public static function loop_end( $wp_query_array ) { |
|
| 384 | + public static function loop_end($wp_query_array) { |
|
| 385 | 385 | global $post; |
| 386 | - do_action( 'AHEE_event_details_after_post', $post, $wp_query_array ); |
|
| 386 | + do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | |
@@ -396,18 +396,18 @@ discard block |
||
| 396 | 396 | */ |
| 397 | 397 | public function wp_enqueue_scripts() { |
| 398 | 398 | // get some style |
| 399 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && apply_filters( 'FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE )) { |
|
| 400 | - EE_Registry::instance()->load_helper( 'File' ); |
|
| 399 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE)) { |
|
| 400 | + EE_Registry::instance()->load_helper('File'); |
|
| 401 | 401 | // first check uploads folder |
| 402 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
| 403 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
| 402 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
| 403 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
| 404 | 404 | } else { |
| 405 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
| 405 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
| 406 | 406 | } |
| 407 | - wp_enqueue_script( $this->theme ); |
|
| 408 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
| 409 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
| 410 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
| 407 | + wp_enqueue_script($this->theme); |
|
| 408 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
| 409 | + EE_Registry::instance()->load_helper('Maps'); |
|
| 410 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | } |
@@ -426,12 +426,12 @@ discard block |
||
| 426 | 426 | * @return bool |
| 427 | 427 | */ |
| 428 | 428 | public static function display_venue() { |
| 429 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
| 429 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
| 430 | 430 | /** @type EE_Event_Single_Config $config */ |
| 431 | 431 | $config = EED_Event_Single::instance()->config(); |
| 432 | - $display_venue= isset( $config->display_venue ) ? $config->display_venue : TRUE; |
|
| 432 | + $display_venue = isset($config->display_venue) ? $config->display_venue : TRUE; |
|
| 433 | 433 | $venue_name = EEH_Venue_View::venue_name(); |
| 434 | - return $display_venue && ! empty( $venue_name ) ? TRUE : FALSE; |
|
| 434 | + return $display_venue && ! empty($venue_name) ? TRUE : FALSE; |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | |
| 18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
| 18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * espresso_get_template_part |
| 21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | * @param string $name The name of the specialised template. |
| 26 | 26 | * @return string the html output for the formatted money value |
| 27 | 27 | */ |
| 28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
| 29 | - EEH_Template::get_template_part( $slug, $name ); |
|
| 28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
| 29 | + EEH_Template::get_template_part($slug, $name); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
| 35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
| 36 | 36 | /** |
| 37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
| 38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @param string $suffix added to the end of the generated class |
| 43 | 43 | * @return string |
| 44 | 44 | */ |
| 45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
| 46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
| 45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
| 46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return boolean |
| 71 | 71 | */ |
| 72 | 72 | public static function is_espresso_theme() { |
| 73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
| 73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | * @return void |
| 80 | 80 | */ |
| 81 | 81 | public static function load_espresso_theme_functions() { |
| 82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
| 83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
| 84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
| 82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
| 83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
| 84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
| 93 | 93 | * @return array |
| 94 | 94 | */ |
| 95 | 95 | public static function get_espresso_themes() { |
| 96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
| 97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
| 98 | - if ( empty( $espresso_themes ) ) { |
|
| 96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
| 97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
| 98 | + if (empty($espresso_themes)) { |
|
| 99 | 99 | return array(); |
| 100 | 100 | } |
| 101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
| 102 | - unset( $espresso_themes[ $key ] ); |
|
| 101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
| 102 | + unset($espresso_themes[$key]); |
|
| 103 | 103 | } |
| 104 | 104 | EEH_Template::$_espresso_themes = array(); |
| 105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
| 106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
| 105 | + foreach ($espresso_themes as $espresso_theme) { |
|
| 106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
| 122 | 122 | * @param bool $return_string |
| 123 | 123 | * @return string the html output for the formatted money value |
| 124 | 124 | */ |
| 125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
| 126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
| 125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
| 126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
| 127 | 127 | $templates = array(); |
| 128 | 128 | $name = (string) $name; |
| 129 | - if ( $name != '' ) { |
|
| 129 | + if ($name != '') { |
|
| 130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
| 131 | 131 | } |
| 132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
| 133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
| 134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
| 133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
| 134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
| 182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
| 183 | 183 | * @return mixed |
| 184 | 184 | */ |
| 185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
| 185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
| 186 | 186 | // first use WP locate_template to check for template in the current theme folder |
| 187 | - $template_path = locate_template( $templates ); |
|
| 187 | + $template_path = locate_template($templates); |
|
| 188 | 188 | |
| 189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
| 189 | + if ($check_if_custom && ! empty($template_path)) |
|
| 190 | 190 | return TRUE; |
| 191 | 191 | |
| 192 | 192 | // not in the theme |
| 193 | - if ( empty( $template_path )) { |
|
| 193 | + if (empty($template_path)) { |
|
| 194 | 194 | // not even a template to look for ? |
| 195 | - if ( empty( $templates )) { |
|
| 195 | + if (empty($templates)) { |
|
| 196 | 196 | // get post_type |
| 197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
| 197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
| 198 | 198 | // get array of EE Custom Post Types |
| 199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
| 200 | 200 | // build template name based on request |
| 201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
| 202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
| 203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
| 204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
| 201 | + if (isset($EE_CPTs[$post_type])) { |
|
| 202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
| 203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
| 204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | // currently active EE template theme |
@@ -210,80 +210,80 @@ discard block |
||
| 210 | 210 | // array of paths to folders that may contain templates |
| 211 | 211 | $template_folder_paths = array( |
| 212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
| 213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
| 213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
| 214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
| 215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
| 216 | 216 | ); |
| 217 | 217 | |
| 218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
| 219 | - if ( ! $check_if_custom ) { |
|
| 219 | + if ( ! $check_if_custom) { |
|
| 220 | 220 | $core_paths = array( |
| 221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
| 222 | - EE_PUBLIC . $current_theme, |
|
| 222 | + EE_PUBLIC.$current_theme, |
|
| 223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
| 224 | - EE_TEMPLATES . $current_theme, |
|
| 224 | + EE_TEMPLATES.$current_theme, |
|
| 225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
| 226 | 226 | EE_PLUGIN_DIR_PATH |
| 227 | 227 | ); |
| 228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
| 228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // now filter that array |
| 232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
| 233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
| 234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
| 232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
| 233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
| 234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
| 235 | 235 | // array to hold all possible template paths |
| 236 | 236 | $full_template_paths = array(); |
| 237 | 237 | |
| 238 | 238 | EE_Registry::instance()->load_helper('File'); |
| 239 | 239 | // loop through $templates |
| 240 | - foreach ( $templates as $template ) { |
|
| 240 | + foreach ($templates as $template) { |
|
| 241 | 241 | // normalize directory separators |
| 242 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
| 243 | - $file_name = basename( $template ); |
|
| 244 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
| 242 | + $template = EEH_File::standardise_directory_separators($template); |
|
| 243 | + $file_name = basename($template); |
|
| 244 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
| 245 | 245 | // while looping through all template folder paths |
| 246 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
| 246 | + foreach ($template_folder_paths as $template_folder_path) { |
|
| 247 | 247 | // normalize directory separators |
| 248 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
| 248 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
| 249 | 249 | // determine if any common base path exists between the two paths |
| 250 | 250 | $common_base_path = EEH_Template::_find_common_base_path( |
| 251 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
| 251 | + array($template_folder_path, $template_path_minus_file_name) |
|
| 252 | 252 | ); |
| 253 | - if ( $common_base_path !== '' ) { |
|
| 253 | + if ($common_base_path !== '') { |
|
| 254 | 254 | // both paths have a common base, so just tack the filename onto our search path |
| 255 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
| 255 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
| 256 | 256 | } else { |
| 257 | 257 | // no common base path, so let's just concatenate |
| 258 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
| 258 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
| 259 | 259 | } |
| 260 | 260 | // build up our template locations array by adding our resolved paths |
| 261 | 261 | $full_template_paths[] = $resolved_path; |
| 262 | 262 | } |
| 263 | 263 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
| 264 | - array_unshift( $full_template_paths, $template ); |
|
| 264 | + array_unshift($full_template_paths, $template); |
|
| 265 | 265 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
| 266 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
| 266 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
| 267 | 267 | } |
| 268 | 268 | // filter final array of full template paths |
| 269 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
| 269 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
| 270 | 270 | // now loop through our final array of template location paths and check each location |
| 271 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
| 272 | - if ( is_readable( $full_template_path )) { |
|
| 273 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
| 271 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
| 272 | + if (is_readable($full_template_path)) { |
|
| 273 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
| 274 | 274 | break; |
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | // if we got it and you want to see it... |
| 279 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
| 280 | - if ( $return_string ) { |
|
| 281 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
| 279 | + if ($template_path && $load && ! $check_if_custom) { |
|
| 280 | + if ($return_string) { |
|
| 281 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
| 282 | 282 | } else { |
| 283 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
| 283 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
| 286 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | |
@@ -296,21 +296,21 @@ discard block |
||
| 296 | 296 | * @param array $paths |
| 297 | 297 | * @return string |
| 298 | 298 | */ |
| 299 | - protected static function _find_common_base_path( $paths ) { |
|
| 299 | + protected static function _find_common_base_path($paths) { |
|
| 300 | 300 | $last_offset = 0; |
| 301 | 301 | $common_base_path = ''; |
| 302 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
| 302 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
| 303 | 303 | $dir_length = $index - $last_offset + 1; |
| 304 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
| 305 | - foreach ( $paths as $path ) { |
|
| 306 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
| 304 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
| 305 | + foreach ($paths as $path) { |
|
| 306 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
| 307 | 307 | return $common_base_path; |
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | $common_base_path .= $directory; |
| 311 | 311 | $last_offset = $index + 1; |
| 312 | 312 | } |
| 313 | - return substr( $common_base_path, 0, -1 ); |
|
| 313 | + return substr($common_base_path, 0, -1); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | |
@@ -322,9 +322,9 @@ discard block |
||
| 322 | 322 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
| 323 | 323 | * @return mixed string |
| 324 | 324 | */ |
| 325 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
| 325 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
| 326 | 326 | //require the template validator for verifying variables are set according to how the template requires |
| 327 | - EE_Registry::instance()->load_helper( 'Template_Validator' ); |
|
| 327 | + EE_Registry::instance()->load_helper('Template_Validator'); |
|
| 328 | 328 | |
| 329 | 329 | /** |
| 330 | 330 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -335,26 +335,26 @@ discard block |
||
| 335 | 335 | * |
| 336 | 336 | * @since 4.6.0 |
| 337 | 337 | */ |
| 338 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
| 339 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
| 338 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
| 339 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
| 340 | 340 | |
| 341 | 341 | // you gimme nuttin - YOU GET NUTTIN !! |
| 342 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
| 342 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
| 343 | 343 | return ''; |
| 344 | 344 | } |
| 345 | 345 | // if $template_args are not in an array, then make it so |
| 346 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
| 347 | - $template_args = array( $template_args ); |
|
| 346 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
| 347 | + $template_args = array($template_args); |
|
| 348 | 348 | } |
| 349 | - extract( (array) $template_args); |
|
| 349 | + extract((array) $template_args); |
|
| 350 | 350 | |
| 351 | - if ( $return_string ) { |
|
| 351 | + if ($return_string) { |
|
| 352 | 352 | // because we want to return a string, we are going to capture the output |
| 353 | 353 | ob_start(); |
| 354 | - include( $template_path ); |
|
| 354 | + include($template_path); |
|
| 355 | 355 | return ob_get_clean(); |
| 356 | 356 | } else { |
| 357 | - include( $template_path ); |
|
| 357 | + include($template_path); |
|
| 358 | 358 | } |
| 359 | 359 | return ''; |
| 360 | 360 | } |
@@ -372,27 +372,27 @@ discard block |
||
| 372 | 372 | * @param string $suffix added to the end of the generated class |
| 373 | 373 | * @return string |
| 374 | 374 | */ |
| 375 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
| 375 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
| 376 | 376 | // in the beginning... |
| 377 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
| 377 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
| 378 | 378 | // da muddle |
| 379 | 379 | $class = ''; |
| 380 | 380 | // the end |
| 381 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
| 381 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
| 382 | 382 | // is the passed object an EE object ? |
| 383 | - if ( $object instanceof EE_Base_Class ) { |
|
| 383 | + if ($object instanceof EE_Base_Class) { |
|
| 384 | 384 | // grab the exact type of object |
| 385 | - $obj_class = get_class( $object ); |
|
| 385 | + $obj_class = get_class($object); |
|
| 386 | 386 | // depending on the type of object... |
| 387 | - switch ( $obj_class ) { |
|
| 387 | + switch ($obj_class) { |
|
| 388 | 388 | // no specifics just yet... |
| 389 | 389 | default : |
| 390 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
| 391 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
| 390 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
| 391 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
| 392 | 392 | |
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | - return $prefix . $class . $suffix; |
|
| 395 | + return $prefix.$class.$suffix; |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | |
@@ -408,50 +408,50 @@ discard block |
||
| 408 | 408 | * @param string $cur_code_span_class |
| 409 | 409 | * @return string the html output for the formatted money value |
| 410 | 410 | */ |
| 411 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
| 411 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
| 412 | 412 | // ensure amount was received |
| 413 | - if ( is_null( $amount ) ) { |
|
| 414 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
| 415 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 413 | + if (is_null($amount)) { |
|
| 414 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
| 415 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 416 | 416 | return ''; |
| 417 | 417 | } |
| 418 | 418 | //ensure amount is float |
| 419 | 419 | $amount = (float) $amount; |
| 420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
| 421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
| 421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
| 422 | 422 | // still a number or was amount converted to a string like "free" ? |
| 423 | - if ( is_float( $amount_formatted )) { |
|
| 423 | + if (is_float($amount_formatted)) { |
|
| 424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
| 425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
| 425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
| 426 | 426 | // verify results |
| 427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
| 427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
| 428 | 428 | // set default config country currency settings |
| 429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
| 430 | 430 | } |
| 431 | 431 | // format float |
| 432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
| 432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
| 433 | 433 | // add formatting ? |
| 434 | - if ( ! $return_raw ) { |
|
| 434 | + if ( ! $return_raw) { |
|
| 435 | 435 | // add currency sign |
| 436 | - if( $mny->sign_b4 ){ |
|
| 437 | - if( $amount >= 0 ){ |
|
| 438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
| 439 | - }else{ |
|
| 440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
| 436 | + if ($mny->sign_b4) { |
|
| 437 | + if ($amount >= 0) { |
|
| 438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
| 439 | + } else { |
|
| 440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - }else{ |
|
| 444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
| 443 | + } else { |
|
| 444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | // add currency code ? |
| 448 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
| 448 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
| 449 | 449 | } |
| 450 | 450 | // filter results |
| 451 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
| 451 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
| 452 | 452 | } |
| 453 | 453 | // clean up vars |
| 454 | - unset( $mny ); |
|
| 454 | + unset($mny); |
|
| 455 | 455 | // return formatted currency amount |
| 456 | 456 | return $amount_formatted; |
| 457 | 457 | } |
@@ -466,11 +466,11 @@ discard block |
||
| 466 | 466 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
| 467 | 467 | * @return string The localized label for the status id. |
| 468 | 468 | */ |
| 469 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
| 469 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
| 470 | 470 | /** @type EEM_Status $EEM_Status */ |
| 471 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
| 472 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
| 473 | - return $status[ $status_id ]; |
|
| 471 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
| 472 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
| 473 | + return $status[$status_id]; |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | |
@@ -483,9 +483,9 @@ discard block |
||
| 483 | 483 | * @param string $icon |
| 484 | 484 | * @return string the html output for the button |
| 485 | 485 | */ |
| 486 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) { |
|
| 487 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
| 488 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>'; |
|
| 486 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') { |
|
| 487 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
| 488 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>'; |
|
| 489 | 489 | return $button; |
| 490 | 490 | } |
| 491 | 491 | |
@@ -502,21 +502,21 @@ discard block |
||
| 502 | 502 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
| 503 | 503 | * @return string generated link |
| 504 | 504 | */ |
| 505 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
| 505 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
| 506 | 506 | |
| 507 | - if ( ! $page ) |
|
| 508 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
| 507 | + if ( ! $page) |
|
| 508 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
| 509 | 509 | |
| 510 | - if ( ! $action ) |
|
| 511 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
| 510 | + if ( ! $action) |
|
| 511 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
| 512 | 512 | |
| 513 | 513 | $action = empty($action) ? 'default' : $action; |
| 514 | 514 | |
| 515 | 515 | |
| 516 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
| 517 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
| 518 | - $help_text = !$help_text ? '' : $help_text; |
|
| 519 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
| 516 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
| 517 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
| 518 | + $help_text = ! $help_text ? '' : $help_text; |
|
| 519 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | |
@@ -528,31 +528,31 @@ discard block |
||
| 528 | 528 | * @param EE_Help_Tour |
| 529 | 529 | * @return string html |
| 530 | 530 | */ |
| 531 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
| 531 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
| 532 | 532 | $id = $tour->get_slug(); |
| 533 | 533 | $stops = $tour->get_stops(); |
| 534 | 534 | |
| 535 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
| 535 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
| 536 | 536 | |
| 537 | - foreach ( $stops as $stop ) { |
|
| 538 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
| 539 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
| 537 | + foreach ($stops as $stop) { |
|
| 538 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
| 539 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
| 540 | 540 | |
| 541 | 541 | //if container is set to modal then let's make sure we set the options accordingly |
| 542 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
| 542 | + if (empty($data_id) && empty($data_class)) { |
|
| 543 | 543 | $stop['options']['modal'] = true; |
| 544 | 544 | $stop['options']['expose'] = true; |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
| 548 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
| 547 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
| 548 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
| 549 | 549 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
| 550 | 550 | |
| 551 | 551 | //options |
| 552 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
| 552 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
| 553 | 553 | $options = ' data-options="'; |
| 554 | - foreach ( $stop['options'] as $option => $value ) { |
|
| 555 | - $options .= $option . ':' . $value . ';'; |
|
| 554 | + foreach ($stop['options'] as $option => $value) { |
|
| 555 | + $options .= $option.':'.$value.';'; |
|
| 556 | 556 | } |
| 557 | 557 | $options .= '"'; |
| 558 | 558 | } else { |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | //let's put all together |
| 563 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
| 563 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | $content .= '</ol>'; |
@@ -581,31 +581,31 @@ discard block |
||
| 581 | 581 | * @throws EE_Error |
| 582 | 582 | * @return string html structure for status. |
| 583 | 583 | */ |
| 584 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
| 585 | - if ( !is_array( $status_array ) ) |
|
| 586 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
| 584 | + public static function status_legend($status_array, $active_status = '') { |
|
| 585 | + if ( ! is_array($status_array)) |
|
| 586 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
| 587 | 587 | |
| 588 | 588 | $setup_array = array(); |
| 589 | - foreach ( $status_array as $item => $status ) { |
|
| 589 | + foreach ($status_array as $item => $status) { |
|
| 590 | 590 | $setup_array[$item] = array( |
| 591 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
| 592 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
| 591 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
| 592 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
| 593 | 593 | 'status' => $status |
| 594 | 594 | ); |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
| 598 | - $content .= '<h4>' . __('Status Legend', 'event_espresso') . '</h4>' . "\n"; |
|
| 599 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
| 600 | - foreach ( $setup_array as $item => $details ) { |
|
| 597 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
| 598 | + $content .= '<h4>'.__('Status Legend', 'event_espresso').'</h4>'."\n"; |
|
| 599 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
| 600 | + foreach ($setup_array as $item => $details) { |
|
| 601 | 601 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
| 602 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
| 603 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
| 604 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
| 605 | - $content .= '</dt>' . "\n"; |
|
| 602 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
| 603 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
| 604 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
| 605 | + $content .= '</dt>'."\n"; |
|
| 606 | 606 | } |
| 607 | - $content .= '</dl>' . "\n"; |
|
| 608 | - $content .= '</div>' . "\n"; |
|
| 607 | + $content .= '</dl>'."\n"; |
|
| 608 | + $content .= '</div>'."\n"; |
|
| 609 | 609 | return $content; |
| 610 | 610 | } |
| 611 | 611 | |
@@ -618,8 +618,8 @@ discard block |
||
| 618 | 618 | * @return string |
| 619 | 619 | */ |
| 620 | 620 | public static function layout_array_as_table($data) { |
| 621 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
| 622 | - $data = (array)$data; |
|
| 621 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
| 622 | + $data = (array) $data; |
|
| 623 | 623 | } |
| 624 | 624 | EE_Registry::instance()->load_helper('Array'); |
| 625 | 625 | ob_start(); |
@@ -633,10 +633,10 @@ discard block |
||
| 633 | 633 | ?> |
| 634 | 634 | <tr> |
| 635 | 635 | <td> |
| 636 | - <?php echo $data_key;?> |
|
| 636 | + <?php echo $data_key; ?> |
|
| 637 | 637 | </td> |
| 638 | 638 | <td> |
| 639 | - <?php echo self::layout_array_as_table($data_values);?> |
|
| 639 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
| 640 | 640 | </td> |
| 641 | 641 | </tr> |
| 642 | 642 | <?php |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | <ul> |
| 651 | 651 | <?php |
| 652 | 652 | foreach ($data as $datum) { |
| 653 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
| 653 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
| 654 | 654 | }?> |
| 655 | 655 | </ul> |
| 656 | 656 | <?php |
@@ -680,8 +680,8 @@ discard block |
||
| 680 | 680 | * |
| 681 | 681 | * @return string |
| 682 | 682 | */ |
| 683 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
| 684 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
| 683 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
| 684 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | |
@@ -705,13 +705,13 @@ discard block |
||
| 705 | 705 | * ) |
| 706 | 706 | * @return string |
| 707 | 707 | */ |
| 708 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
| 708 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
| 709 | 709 | $page_links = array(); |
| 710 | 710 | $disable_first = $disable_last = ''; |
| 711 | 711 | $total_items = (int) $total_items; |
| 712 | 712 | $per_page = (int) $per_page; |
| 713 | 713 | $current = (int) $current; |
| 714 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
| 714 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
| 715 | 715 | |
| 716 | 716 | //filter items_label |
| 717 | 717 | $items_label = apply_filters( |
@@ -719,68 +719,68 @@ discard block |
||
| 719 | 719 | $items_label |
| 720 | 720 | ); |
| 721 | 721 | |
| 722 | - if ( empty( $items_label ) |
|
| 723 | - || ! is_array( $items_label ) |
|
| 724 | - || ! isset( $items_label['single'] ) |
|
| 725 | - || ! isset( $items_label['plural'] ) ) { |
|
| 722 | + if (empty($items_label) |
|
| 723 | + || ! is_array($items_label) |
|
| 724 | + || ! isset($items_label['single']) |
|
| 725 | + || ! isset($items_label['plural'])) { |
|
| 726 | 726 | $items_label = array( |
| 727 | - 'single' => __( '1 item', 'event_espresso' ), |
|
| 728 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
| 727 | + 'single' => __('1 item', 'event_espresso'), |
|
| 728 | + 'plural' => __('%s items', 'event_espresso') |
|
| 729 | 729 | ); |
| 730 | 730 | } else { |
| 731 | 731 | $items_label = array( |
| 732 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
| 733 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
| 732 | + 'single' => '1 '.esc_html($items_label['single']), |
|
| 733 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
| 734 | 734 | ); |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | - $total_pages = ceil( $total_items / $per_page ); |
|
| 737 | + $total_pages = ceil($total_items / $per_page); |
|
| 738 | 738 | |
| 739 | - if ( $total_pages <= 1 ) |
|
| 739 | + if ($total_pages <= 1) |
|
| 740 | 740 | return ''; |
| 741 | 741 | |
| 742 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
| 742 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
| 743 | 743 | |
| 744 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
| 744 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
| 745 | 745 | |
| 746 | - if ( $current === 1 ) { |
|
| 746 | + if ($current === 1) { |
|
| 747 | 747 | $disable_first = ' disabled'; |
| 748 | 748 | } |
| 749 | - if ( $current == $total_pages ) { |
|
| 749 | + if ($current == $total_pages) { |
|
| 750 | 750 | $disable_last = ' disabled'; |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 754 | - 'first-page' . $disable_first, |
|
| 755 | - esc_attr__( 'Go to the first page' ), |
|
| 756 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
| 753 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 754 | + 'first-page'.$disable_first, |
|
| 755 | + esc_attr__('Go to the first page'), |
|
| 756 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
| 757 | 757 | '«' |
| 758 | 758 | ); |
| 759 | 759 | |
| 760 | 760 | $page_links[] = sprintf( |
| 761 | 761 | '<a class="%s" title="%s" href="%s">%s</a>', |
| 762 | - 'prev-page' . $disable_first, |
|
| 763 | - esc_attr__( 'Go to the previous page' ), |
|
| 764 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
| 762 | + 'prev-page'.$disable_first, |
|
| 763 | + esc_attr__('Go to the previous page'), |
|
| 764 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
| 765 | 765 | '‹' |
| 766 | 766 | ); |
| 767 | 767 | |
| 768 | - if ( ! $show_num_field ) { |
|
| 768 | + if ( ! $show_num_field) { |
|
| 769 | 769 | $html_current_page = $current; |
| 770 | 770 | } else { |
| 771 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
| 772 | - esc_attr__( 'Current page' ), |
|
| 771 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
| 772 | + esc_attr__('Current page'), |
|
| 773 | 773 | $current, |
| 774 | - strlen( $total_pages ) |
|
| 774 | + strlen($total_pages) |
|
| 775 | 775 | ); |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | $html_total_pages = sprintf( |
| 779 | 779 | '<span class="total-pages">%s</span>', |
| 780 | - number_format_i18n( $total_pages ) |
|
| 780 | + number_format_i18n($total_pages) |
|
| 781 | 781 | ); |
| 782 | 782 | $page_links[] = sprintf( |
| 783 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
| 783 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
| 784 | 784 | $html_current_page, |
| 785 | 785 | $html_total_pages, |
| 786 | 786 | '<span class="paging-input">', |
@@ -789,29 +789,29 @@ discard block |
||
| 789 | 789 | |
| 790 | 790 | $page_links[] = sprintf( |
| 791 | 791 | '<a class="%s" title="%s" href="%s">%s</a>', |
| 792 | - 'next-page' . $disable_last, |
|
| 793 | - esc_attr__( 'Go to the next page' ), |
|
| 794 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
| 792 | + 'next-page'.$disable_last, |
|
| 793 | + esc_attr__('Go to the next page'), |
|
| 794 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
| 795 | 795 | '›' |
| 796 | 796 | ); |
| 797 | 797 | |
| 798 | 798 | $page_links[] = sprintf( |
| 799 | 799 | '<a class="%s" title="%s" href="%s">%s</a>', |
| 800 | - 'last-page' . $disable_last, |
|
| 801 | - esc_attr__( 'Go to the last page' ), |
|
| 802 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
| 800 | + 'last-page'.$disable_last, |
|
| 801 | + esc_attr__('Go to the last page'), |
|
| 802 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
| 803 | 803 | '»' |
| 804 | 804 | ); |
| 805 | 805 | |
| 806 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
| 806 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
| 807 | 807 | // set page class |
| 808 | - if ( $total_pages ) { |
|
| 808 | + if ($total_pages) { |
|
| 809 | 809 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
| 810 | 810 | } else { |
| 811 | 811 | $page_class = ' no-pages'; |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
| 814 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | * @param WP $WP |
| 52 | 52 | * @return void |
| 53 | 53 | */ |
| 54 | - public function run( WP $WP ) { |
|
| 55 | - if ( did_action( 'pre_get_posts' ) && did_action( 'send_headers' ) ) { |
|
| 54 | + public function run(WP $WP) { |
|
| 55 | + if (did_action('pre_get_posts') && did_action('send_headers')) { |
|
| 56 | 56 | global $wp_query; |
| 57 | 57 | EED_Single_Page_Checkout::load_reg_steps(); |
| 58 | - EED_Single_Page_Checkout::init( $wp_query ); |
|
| 58 | + EED_Single_Page_Checkout::init($wp_query); |
|
| 59 | 59 | } else { |
| 60 | 60 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
| 61 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
| 61 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
| 62 | 62 | // this will trigger the EED_Single_Page_Checkout module's run() method during the pre_get_posts hook point, |
| 63 | 63 | // this allows us to initialize things, enqueue assets, etc, |
| 64 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'init' ), 10, 1 ); |
|
| 64 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'init'), 10, 1); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param array $attributes |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | - public function process_shortcode( $attributes = array() ) { |
|
| 77 | + public function process_shortcode($attributes = array()) { |
|
| 78 | 78 | return EE_Registry::instance()->REQ->get_output(); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @access public |
| 51 | 51 | * @param \WP $WP |
| 52 | 52 | */ |
| 53 | - public function run( WP $WP ) { |
|
| 53 | + public function run(WP $WP) { |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | * @param array $attributes |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | - public function process_shortcode( $attributes = array() ) { |
|
| 64 | - extract( $attributes ); |
|
| 65 | - $event_id = isset( $event_id ) ? $event_id : 0; |
|
| 66 | - $event = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $event_id ); |
|
| 63 | + public function process_shortcode($attributes = array()) { |
|
| 64 | + extract($attributes); |
|
| 65 | + $event_id = isset($event_id) ? $event_id : 0; |
|
| 66 | + $event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($event_id); |
|
| 67 | 67 | ob_start(); |
| 68 | - do_action( 'AHEE_event_details_before_post', $event_id ); |
|
| 69 | - espresso_ticket_selector( $event ); |
|
| 70 | - do_action( 'AHEE_event_details_after_post' ); |
|
| 68 | + do_action('AHEE_event_details_before_post', $event_id); |
|
| 69 | + espresso_ticket_selector($event); |
|
| 70 | + do_action('AHEE_event_details_after_post'); |
|
| 71 | 71 | return ob_get_clean(); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | * @param WP $WP |
| 51 | 51 | * @return void |
| 52 | 52 | */ |
| 53 | - public function run( WP $WP ) { |
|
| 54 | - if ( did_action( 'pre_get_posts' ) && did_action( 'send_headers' ) ) { |
|
| 53 | + public function run(WP $WP) { |
|
| 54 | + if (did_action('pre_get_posts') && did_action('send_headers')) { |
|
| 55 | 55 | EED_Events_Archive::instance()->event_list(); |
| 56 | 56 | } else { |
| 57 | 57 | // this will trigger the EED_Events_Archive module's event_list() method during the pre_get_posts hook point, |
| 58 | 58 | // this allows us to initialize things, enqueue assets, etc, |
| 59 | 59 | // as well, this saves an instantiation of the module in an array using 'espresso_events' as the key, so that we can retrieve it |
| 60 | - add_action( 'pre_get_posts', array( EED_Events_Archive::instance(), 'event_list' ) ); |
|
| 60 | + add_action('pre_get_posts', array(EED_Events_Archive::instance(), 'event_list')); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | * @param array $attributes |
| 80 | 80 | * @return string |
| 81 | 81 | */ |
| 82 | - public function process_shortcode( $attributes = array() ) { |
|
| 82 | + public function process_shortcode($attributes = array()) { |
|
| 83 | 83 | // make sure EED_Events_Archive is setup properly |
| 84 | - if ( apply_filters( 'FHEE__fallback_shortcode_processor__EES_Espresso_Events', FALSE )) { |
|
| 84 | + if (apply_filters('FHEE__fallback_shortcode_processor__EES_Espresso_Events', FALSE)) { |
|
| 85 | 85 | EED_Events_Archive::instance()->event_list(); |
| 86 | 86 | } |
| 87 | 87 | // merge in any attributes passed via fallback shortcode processor |
| 88 | - $attributes = array_merge( (array)$attributes, (array)$this->_attributes ); |
|
| 88 | + $attributes = array_merge((array) $attributes, (array) $this->_attributes); |
|
| 89 | 89 | //set default attributes |
| 90 | 90 | $default_espresso_events_shortcode_atts = array( |
| 91 | 91 | 'title' => NULL, |
@@ -99,26 +99,26 @@ discard block |
||
| 99 | 99 | 'fallback_shortcode_processor' => FALSE |
| 100 | 100 | ); |
| 101 | 101 | // allow the defaults to be filtered |
| 102 | - $default_espresso_events_shortcode_atts = apply_filters( 'EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts', $default_espresso_events_shortcode_atts ); |
|
| 102 | + $default_espresso_events_shortcode_atts = apply_filters('EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts', $default_espresso_events_shortcode_atts); |
|
| 103 | 103 | // grab attributes and merge with defaults, then extract |
| 104 | - $attributes = array_merge( $default_espresso_events_shortcode_atts, $attributes ); |
|
| 104 | + $attributes = array_merge($default_espresso_events_shortcode_atts, $attributes); |
|
| 105 | 105 | // make sure we use the_excerpt() |
| 106 | - add_filter( 'FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true' ); |
|
| 106 | + add_filter('FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true'); |
|
| 107 | 107 | // apply query filters |
| 108 | - add_filter( 'FHEE__EEH_Event_Query__apply_query_filters', '__return_true' ); |
|
| 108 | + add_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true'); |
|
| 109 | 109 | // run the query |
| 110 | 110 | global $wp_query; |
| 111 | - $wp_query = new EE_Event_List_Query( $attributes ); |
|
| 111 | + $wp_query = new EE_Event_List_Query($attributes); |
|
| 112 | 112 | // check what template is loaded and load filters accordingly |
| 113 | - EED_Events_Archive::instance()->template_include( 'loop-espresso_events.php' ); |
|
| 113 | + EED_Events_Archive::instance()->template_include('loop-espresso_events.php'); |
|
| 114 | 114 | // load our template |
| 115 | - $event_list = EEH_Template::locate_template( 'loop-espresso_events.php', array(), TRUE, TRUE ); |
|
| 115 | + $event_list = EEH_Template::locate_template('loop-espresso_events.php', array(), TRUE, TRUE); |
|
| 116 | 116 | // now reset the query and postdata |
| 117 | 117 | wp_reset_query(); |
| 118 | 118 | wp_reset_postdata(); |
| 119 | 119 | EED_Events_Archive::remove_all_events_archive_filters(); |
| 120 | 120 | // remove query filters |
| 121 | - remove_filter( 'FHEE__EEH_Event_Query__apply_query_filters', '__return_true' ); |
|
| 121 | + remove_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true'); |
|
| 122 | 122 | // pull our content from the output buffer and return it |
| 123 | 123 | return $event_list; |
| 124 | 124 | } |
@@ -163,46 +163,46 @@ discard block |
||
| 163 | 163 | * @param array $args |
| 164 | 164 | * @return \EE_Event_List_Query |
| 165 | 165 | */ |
| 166 | - function __construct( $args = array() ) { |
|
| 166 | + function __construct($args = array()) { |
|
| 167 | 167 | // EEH_Debug_Tools::printr( $args, '$args <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 168 | 168 | // incoming args could be a mix of WP query args + EE shortcode args |
| 169 | - foreach ( $args as $key =>$value ) { |
|
| 170 | - $property = '_' . $key; |
|
| 169 | + foreach ($args as $key =>$value) { |
|
| 170 | + $property = '_'.$key; |
|
| 171 | 171 | // if the arg is a property of this class, then it's an EE shortcode arg |
| 172 | - if ( property_exists( $this, $property )) { |
|
| 172 | + if (property_exists($this, $property)) { |
|
| 173 | 173 | // set the property value |
| 174 | 174 | $this->$property = $value; |
| 175 | 175 | // then remove it from the array of args that will later be passed to WP_Query() |
| 176 | - unset( $args[ $key ] ); |
|
| 176 | + unset($args[$key]); |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | // setup the events list query |
| 180 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 180 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 181 | 181 | //add query filters |
| 182 | 182 | EEH_Event_Query::add_query_filters(); |
| 183 | 183 | // set params that will get used by the filters |
| 184 | - EEH_Event_Query::set_query_params( $this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort ); |
|
| 184 | + EEH_Event_Query::set_query_params($this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort); |
|
| 185 | 185 | // first off, let's remove any filters from previous queries |
| 186 | - remove_filter( 'FHEE__archive_espresso_events_template__upcoming_events_h1', array( $this, 'event_list_title' )); |
|
| 187 | - remove_all_filters( 'FHEE__content_espresso_events__event_class' ); |
|
| 186 | + remove_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title')); |
|
| 187 | + remove_all_filters('FHEE__content_espresso_events__event_class'); |
|
| 188 | 188 | // Event List Title ? |
| 189 | - add_filter( 'FHEE__archive_espresso_events_template__upcoming_events_h1', array( $this, 'event_list_title' ), 10, 1 ); |
|
| 189 | + add_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title'), 10, 1); |
|
| 190 | 190 | // add the css class |
| 191 | - add_filter( 'FHEE__content_espresso_events__event_class', array( $this, 'event_list_css' ), 10, 1 ); |
|
| 191 | + add_filter('FHEE__content_espresso_events__event_class', array($this, 'event_list_css'), 10, 1); |
|
| 192 | 192 | // the current "page" we are viewing |
| 193 | - $paged = max( 1, get_query_var( 'paged' )); |
|
| 193 | + $paged = max(1, get_query_var('paged')); |
|
| 194 | 194 | // Force these args |
| 195 | - $args = array_merge( $args, array( |
|
| 195 | + $args = array_merge($args, array( |
|
| 196 | 196 | 'post_type' => 'espresso_events', |
| 197 | 197 | 'posts_per_page' => $this->_limit, |
| 198 | 198 | 'update_post_term_cache' => FALSE, |
| 199 | 199 | 'update_post_meta_cache' => FALSE, |
| 200 | 200 | 'paged' => $paged, |
| 201 | - 'offset' => ( $paged - 1 ) * $this->_limit |
|
| 201 | + 'offset' => ($paged - 1) * $this->_limit |
|
| 202 | 202 | )); |
| 203 | 203 | |
| 204 | 204 | // run the query |
| 205 | - parent::__construct( $args ); |
|
| 205 | + parent::__construct($args); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | * @param string $event_list_title |
| 216 | 216 | * @return string |
| 217 | 217 | */ |
| 218 | - public function event_list_title( $event_list_title = '' ) { |
|
| 219 | - if ( ! empty( $this->_title )) { |
|
| 218 | + public function event_list_title($event_list_title = '') { |
|
| 219 | + if ( ! empty($this->_title)) { |
|
| 220 | 220 | return $this->_title; |
| 221 | 221 | } |
| 222 | 222 | return $event_list_title; |
@@ -231,11 +231,11 @@ discard block |
||
| 231 | 231 | * @param string $event_list_css |
| 232 | 232 | * @return array |
| 233 | 233 | */ |
| 234 | - public function event_list_css( $event_list_css = '' ) { |
|
| 235 | - $event_list_css .= ! empty( $event_list_css ) ? ' ' : ''; |
|
| 236 | - $event_list_css .= ! empty( $this->_css_class ) ? $this->_css_class : ''; |
|
| 237 | - $event_list_css .= ! empty( $event_list_css ) ? ' ' : ''; |
|
| 238 | - $event_list_css .= ! empty( $this->_category_slug ) ? $this->_category_slug : ''; |
|
| 234 | + public function event_list_css($event_list_css = '') { |
|
| 235 | + $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
| 236 | + $event_list_css .= ! empty($this->_css_class) ? $this->_css_class : ''; |
|
| 237 | + $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
| 238 | + $event_list_css .= ! empty($this->_category_slug) ? $this->_category_slug : ''; |
|
| 239 | 239 | return $event_list_css; |
| 240 | 240 | } |
| 241 | 241 | |