} $repository_args['tax_query']['relation'] = $operand; } if ( isset( $arguments['date'] ) ) { // The date can be used in many ways, so we juggle a bit here. $date_filters = tribe_events()->get_date_filters(); $date_keys = array_filter( $repository_args, static function ( $key ) use ( $date_filters ) { return in_array( $key, $date_filters, true ); }, ARRAY_FILTER_USE_KEY ); if ( count( $date_keys ) === 1 ) { $date_indices = array_keys( $date_keys ); $date_index = reset( $date_indices ); $date_key = $date_keys[ $date_index ]; if ( $date_key === $arguments['date'] ) { // Let's only set it if we are sure. $repository_args[ $date_index ] = $arguments['date']; } else { $repository_args[ $date_index ] = $date_key; } } } if ( isset( $arguments['featured'] ) ) { $repository_args['featured'] = tribe_is_truthy( $arguments['featured'] ); } return $repository_args; } /** * Alters the context of the view based on the shortcode params stored in the database based on the ID. * * @since 5.0.0 * * @param Context $view_context Context for this request. * @param string $view_slug Slug of the view we are building. * @param View $instance Which view instance we are dealing with. * * @return Context Altered version of the context ready for shortcodes. */ public function filter_view_context( Context $view_context, $view_slug, $instance ) { if ( ! $shortcode_id = $view_context->get( 'shortcode' ) ) { return $view_context; } $arguments = $this->get_database_arguments( $shortcode_id ); if ( empty( $arguments ) ) { return $view_context; } /* Week view/widget only. */ if ( false !== stripos( $view_slug, 'week' ) ) { $offset = $this->get_argument( 'week_offset' ); if ( tribe_is_truthy( $offset ) && empty( $view_context->get( 'eventDate' ) ) ) { $start_date = Dates::build_date_object( $this->get_argument( 'date', 'now' ) ); $is_negative = '-' === substr( $offset, 0, 1 ); // Set up for negative weeks. $interval = ( $is_negative ) ? substr( $offset, 1, 1 ) : $offset; $di = Dates::interval( "P{$interval}W" ); $di->invert = absint( $is_negative ); $start_date->add( $di ); $arguments['date'] = $start_date->format( Dates::DBDATEFORMAT ); } $arguments['week_events_per_day'] = $this->get_argument( 'week_events_per_day' ); } return $this->alter_context( $view_context, $arguments ); } /** * Filters the default view in the views manager for shortcodes navigation. * * @since 4.7.9 * * @param string $view_class Fully qualified class name for default view. * * @return string Fully qualified class name for default view of the shortcode in question. */ public function filter_default_url( $view_class ) { if ( tribe_context()->doing_php_initial_state() ) { return $view_class; } // Use the global context here as we should be in the context of an AJAX shortcode request. $shortcode_id = tribe_context()->get( 'shortcode', false ); if ( false === $shortcode_id ) { // If we're not in the context of an AJAX shortcode request, bail. return $view_class; } $shortcode_args = $this->get_database_arguments( $shortcode_id ); if ( ! $shortcode_args['view'] ) { return $view_class; } return tribe( Views_Manager::class )->get_view_class_by_slug( $shortcode_args['view'] ); } /** * Filters the View HTML classes to add some related to PRO features. * * @since 5.0.0 * * @param array $html_classes The current View HTML classes. * @param string $slug The View registered slug. * @param View_Interface $view The View currently rendering. * * @return array The filtered HTML classes. */ public function filter_view_html_classes( $html_classes, $slug, $view ) { $context = $view->get_context(); if ( ! $context instanceof Context ) { return $html_classes; } $shortcode = $context->get( 'shortcode', false ); if ( ! $shortcode ) { return $html_classes; } $shortcode_args = $this->get_database_arguments( $shortcode ); $html_classes[] = 'tribe-events-view--shortcode'; $html_classes[] = 'tribe-events-view--shortcode-' . $shortcode; $container_classes = Arr::get( $shortcode_args, 'container-classes', '' ); if ( ! empty( $container_classes ) ) { $html_classes = array_merge( $html_classes, $container_classes ); } return $html_classes; } /** * Cleans up an array of values as html classes. * * @since 5.5.0 * * @param mixed $value Which classes we are cleaning up. * * @return array Resulting clean html classes. */ public static function validate_array_html_classes( $value ) { if ( ! is_array( $value ) ) { $value = explode( ' ', $value ); } return array_map( 'sanitize_html_class', (array) $value ); } /** * Filters the View data attributes to add some related to PRO features. * * @since 5.0.0 * * @param array $data The current View data attributes classes. * @param string $slug The View registered slug. * @param View_Interface $view The View currently rendering. * * @return array The filtered data attributes. */ public function filter_view_data( $data, $slug, $view ) { if ( ! $view instanceof View_Interface ) { return $data; } $context = $view->get_context(); if ( ! $context instanceof Context ) { return $data; } if ( $shortcode = $context->get( 'shortcode', false ) ) { $data['shortcode'] = $shortcode; } return $data; } /** * Filters the View URL to add the shortcode query arg, if required. * * @since 4.7.9 * @since 5.5.0 Moved this from deprecated Shortcodes\Manager. * * @param string $url The View current URL. * @param bool $canonical Whether to return the canonical version of the URL or the normal one. * @param View_Interface $view This view instance. * * @return string The URL for the view shortcode. */ public function filter_view_url( $url, $canonical, View_Interface $view ) { $context = $view->get_context(); if ( empty( $url ) ) { return $url; } if ( ! $context instanceof Context ) { return $url; } $shortcode_id = $context->get( 'shortcode', false ); if ( false === $shortcode_id ) { return $url; } return add_query_arg( [ 'shortcode' => $shortcode_id ], $url ); } /** * Filters the query arguments array and add the Shortcodes. * * @since 4.7.9 * @since 5.5.0 Moved this from deprecated Shortcodes\Manager. * * @param array $query Arguments used to build the URL. * @param string $view_slug The current view slug. * @param View_Interface $view The current View object. * * @return array Filtered the query arguments for shortcodes. */ public function filter_view_url_query_args( array $query, $view_slug, View_Interface $view ) { $context = $view->get_context(); if ( ! $context instanceof Context ) { return $query; } $shortcode = $context->get( 'shortcode', false ); if ( false === $shortcode ) { return $query; } $query['shortcode'] = $shortcode; return $query; } /** * Filter the breakpoints for the week view widget based on layout. * * @since 5.6.0 * * @param array $breakpoints All breakpoints available. * @param View $view The current View instance being rendered. * * @return array Modified array of available breakpoints. */ public function filter_week_view_breakpoints( $breakpoints, $view ) { $context = $view->get_context(); $widget = $context->get( 'is-widget', false ); $shortcode = $context->get( 'shortcode', false ); if ( false === $widget ) { return $breakpoints; } if ( false === $shortcode ) { return $breakpoints; } $shortcode_args = $this->get_database_arguments( $shortcode ); if ( ! $shortcode_args ) { return $breakpoints; } if ( 'vertical' === $shortcode_args['layout'] ) { // Remove all breakpoints to remain in "mobile view". return []; } elseif ( 'horizontal' === $shortcode_args['layout'] ) { // Simplify breakpoints to remain in "desktop view". unset( $breakpoints['xsmall'] ); $breakpoints['medium'] = 0; return $breakpoints; } // Fallback and space for "auto". return $breakpoints; } /** * Modify the Week events per day of a given view based on arguments from Shortcode. * * @since 5.6.0 * * @param int|string $events_per_day Number of events per day. * @param View $view Current view being rendered. * * @return mixed */ public function filter_week_events_per_day( $events_per_day, $view ) { $context = $view->get_context(); $shortcode = $context->get( 'shortcode', false ); if ( false === $shortcode ) { return $events_per_day; } $shortcode_args = $this->get_database_arguments( $shortcode ); if ( ! $shortcode_args || ! isset( $shortcode_args['count'] ) ) { return $events_per_day; } return $shortcode_args['count']; } }
Fatal error: Uncaught Error: Class 'Tribe\Events\Pro\Views\V2\Shortcodes\Tribe_Events' not found in /home/ocb/public_html/wp-content/plugins/events-calendar-pro/src/Tribe/Views/V2/Shortcodes/Hooks.php:106 Stack trace: #0 /home/ocb/public_html/wp-includes/class-wp-hook.php(326): Tribe\Events\Pro\Views\V2\Shortcodes\Hooks->filter_context_locations(Array) #1 /home/ocb/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #2 /home/ocb/public_html/wp-content/plugins/the-events-calendar/common/src/Tribe/Context.php(1320): apply_filters('tribe_context_l...', Array, Object(Tribe__Context)) #3 /home/ocb/public_html/wp-content/plugins/the-events-calendar/common/src/Tribe/Context.php(463): Tribe__Context->populate_locations() #4 /home/ocb/public_html/wp-content/plugins/the-events-calendar/common/src/Tribe/Context.php(379): Tribe__Context->get_locations() #5 /home/ocb/public_html/wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/iCalendar/Request.php(67): Tribe__Context->get('view', 'default') #6 /home in /home/ocb/public_html/wp-content/plugins/events-calendar-pro/src/Tribe/Views/V2/Shortcodes/Hooks.php on line 106