';print_r($abpet_slider);echo ''; if ( ! empty( $image_column ) ) { $abpet_slider['image_column'] = $image_column; $abpet_slider['show_item'] = ( $params['show'] ?? null ) ?: $image_column * 3; } if ( ! empty( $style ) ) { $slider_style = $style == 'gallery' ? 'gallery' : 'slider'; } else { $slider_style = ( $abpet_slider['slider_style'] ?? null ) ?: 'slider'; } include_once ABPET_Function::template_path( 'layout/' . $slider_style . '.php' ); do_action( 'abpet_' . $slider_style . '_template', $img_ids, $abpet_slider ); } } public function slider_popup( $abpet_slider, $img_ids, $popup_id = '#abpet_slider_' ): void { include_once ABPET_Function::template_path( 'layout/slider_popup.php' ); do_action( 'abpet_slider_popup_template', $abpet_slider, $img_ids, $popup_id ); } public function map( $post_infos = [], $post_id = 0, $style = 'default' ): void { if ( empty( $post_id ) || $post_id <= 0 || get_post_type( $post_id ) !== ABPET_Function::get_cpt() ) { return; } if ( ! ABPET_Function::on_off( 'google_map' ) || ! ABPET_Function::on_off( 'location' ) ) { return; } $google_map_key = ABPET_Function::get_options( 'abpet_configuration', 'google_map_key', '' ); $map_mode = empty( $google_map_key ) ? 'iframe' : 'js'; $locations = ABPET_Function::get_post_info( $post_id, 'abpet_location' ); $map_locations = []; if ( ! empty( $locations ) ) { $loc_values = array_filter( array_map( 'trim', explode( ',', $locations ) ) ); foreach ( $loc_values as $loc ) { $map_data = ABPET_Location[ $loc ]['map'] ?? []; $map_term_meta = is_numeric( $loc ) ? get_term_meta( (int) $loc, '_abpet_map', true ) : []; $map_data = is_array( $map_term_meta ) && ! empty( $map_term_meta ) ? $map_term_meta : $map_data; if ( ! empty( $map_data['lat'] ) && ! empty( $map_data['lng'] ) ) { $map_locations[] = [ 'id' => $loc, 'label' => ABPET_Location[ $loc ]['label'] ?? $loc, 'address' => $map_data['address'] ?? ABPET_Location[ $loc ]['description'] ?? '', 'lat' => $map_data['lat'], 'lng' => $map_data['lng'], 'place' => $map_data['place'] ?? '', ]; } } } if ( empty( $map_locations ) ) { return; } if ( $map_mode === 'js' && ! wp_script_is( 'abpet_gmaps', 'enqueued' ) ) { // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion -- External Google Maps API script; version is managed by Google. wp_enqueue_script( 'abpet_gmaps', 'https://maps.googleapis.com/maps/api/js?key=' . rawurlencode( $google_map_key ) . '&callback=abpet_gmap_frontend_init', array(), null, true ); } $style = sanitize_key( $style ); $style = in_array( $style, [ 'default', 'light', 'modern' ], true ) ? $style : 'default'; include_once ABPET_Function::template_path( 'map/' . $style . '.php' ); do_action( 'abpet_map_' . $style . '_template', $map_locations, $post_id, $map_mode ); } public function timeline( $post_infos = [], $post_id = 0, $style = 'default' ): void { if ( empty( $post_id ) || $post_id <= 0 || get_post_type( $post_id ) !== ABPET_Function::get_cpt() ) { return; } if ( ! ABPET_Function::on_off( 'timeline' ) ) { return; } if ( ( $post_infos['display_timeline'] ?? 'on' ) === 'off' ) { return; } $timeline_items = $post_infos['abpet_timeline'] ?? []; $timeline_items = is_array( $timeline_items ) ? $timeline_items : []; $timeline_items = array_values( array_filter( $timeline_items, static function ( $item ) { return ! empty( $item['title'] ); } ) ); if ( empty( $timeline_items ) ) { return; } $style = sanitize_key( $style ); $style = in_array( $style, [ 'default', 'light', 'modern' ], true ) ? $style : 'default'; include_once ABPET_Function::template_path( 'timeline/' . $style . '.php' ); do_action( 'abpet_timeline_' . $style . '_template', $timeline_items, $post_id ); } public function speaker( $post_infos = [], $post_id = 0, $style = 'default' ): void { if ( empty( $post_id ) || $post_id <= 0 || get_post_type( $post_id ) !== ABPET_Function::get_cpt() ) { return; } if ( ! ABPET_Function::on_off( 'speaker' ) ) { return; } if ( ( $post_infos['display_speaker'] ?? 'on' ) === 'off' ) { return; } $speakers = ABPET_Function::speaker_items( $post_id ); if ( empty( $speakers ) ) { return; } $style = sanitize_key( $style ); $style = in_array( $style, [ 'default', 'light', 'modern' ], true ) ? $style : 'default'; include_once ABPET_Function::template_path( 'speaker/' . $style . '.php' ); do_action( 'abpet_speaker_' . $style . '_template', $speakers, $post_id ); } public function event_schedule_list( int $post_id, array $dates, array $time_infos, string $selected_date = '', string $selected_time = '', string $layout = 'dropdown' ): void { $items = ABPET_Function::event_schedule_items( $post_id, $dates, $time_infos ); if ( ! ABPET_Function::on_off( 'event_date_list' ) || count( $items ) < 2 ) { return; } $is_scroll_layout = 'scroll' === $layout; $dropdown_id = 'abpet-schedule-dropdown-' . $post_id; ?>