ID, 'asp_sermon_mp4', true ); $passage = get_post_meta( $post->ID, 'asp_sermon_bible_passage', true ); ?>



post_type || in_array( $screen->taxonomy, array( 'feg_topic_group', 'sermon_topics' ), true ) || 'sermons_page_feg-predigten' === $hook ) { wp_enqueue_media(); wp_enqueue_script( 'fegp-admin', FEGP_URL . 'assets/js/admin.js', array( 'jquery' ), FEGP_VERSION, true ); wp_localize_script( 'fegp-admin', 'fegpAdmin', array( 'choose' => __( 'Select', 'kanzelbuch' ) ) ); } } add_action( 'admin_enqueue_scripts', 'fegp_admin_assets' ); /** * Image field markup for topic group terms. * * @param int $image_id Attachment ID. */ function fegp_image_field( $image_id ) { wp_nonce_field( 'fegp_term', 'fegp_term_nonce' ); echo ''; echo '
' . ( $image_id ? wp_get_attachment_image( $image_id, 'thumbnail' ) : '' ) . '
'; echo ' '; echo ''; echo '

' . esc_html__( 'Used for every sermon of this group that has no own featured image.', 'kanzelbuch' ) . '

'; } add_action( 'feg_topic_group_add_form_fields', function () { echo '
'; fegp_image_field( 0 ); echo '
'; } ); add_action( 'feg_topic_group_edit_form_fields', function ( $term ) { echo '' . esc_html__( 'Group image', 'kanzelbuch' ) . ''; fegp_image_field( (int) get_term_meta( $term->term_id, 'fegp_image_id', true ) ); echo ''; } ); /** * Group select for topics. * * @param int $selected Selected group ID. */ function fegp_group_select( $selected ) { wp_nonce_field( 'fegp_term', 'fegp_term_nonce' ); wp_dropdown_categories( array( 'taxonomy' => 'feg_topic_group', 'name' => 'fegp_group_id', 'hide_empty' => false, 'hierarchical' => true, 'selected' => (int) $selected, 'show_option_none' => __( '— none —', 'kanzelbuch' ), 'option_none_value' => 0, ) ); } add_action( 'sermon_topics_add_form_fields', function () { echo '
'; fegp_group_select( 0 ); echo '
'; } ); add_action( 'sermon_topics_edit_form_fields', function ( $term ) { echo ''; fegp_group_select( (int) get_term_meta( $term->term_id, 'fegp_group_id', true ) ); echo ''; } ); /** * Save term meta. * * @param int $term_id Term ID. */ function fegp_save_term( $term_id ) { if ( ! isset( $_POST['fegp_term_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['fegp_term_nonce'] ) ), 'fegp_term' ) || ! current_user_can( 'manage_categories' ) ) { return; } if ( isset( $_POST['fegp_image_id'] ) ) { update_term_meta( $term_id, 'fegp_image_id', absint( $_POST['fegp_image_id'] ) ); } if ( isset( $_POST['fegp_group_id'] ) ) { update_term_meta( $term_id, 'fegp_group_id', absint( $_POST['fegp_group_id'] ) ); } } foreach ( array( 'created_feg_topic_group', 'edited_feg_topic_group', 'created_sermon_topics', 'edited_sermon_topics' ) as $fegp_hook ) { add_action( $fegp_hook, 'fegp_save_term' ); } /** * Donate link in plugin row. * * @param array $links Links. * @param string $file Plugin file. * @return array */ function fegp_row_meta( $links, $file ) { if ( plugin_basename( FEGP_FILE ) === $file ) { $links[] = '' . esc_html__( 'Donate', 'kanzelbuch' ) . ''; } return $links; } add_filter( 'plugin_row_meta', 'fegp_row_meta', 10, 2 ); /** * Settings link on plugins page. * * @param array $links Links. * @return array */ function fegp_action_links( $links ) { array_unshift( $links, '' . esc_html__( 'Settings', 'kanzelbuch' ) . '' ); return $links; } add_filter( 'plugin_action_links_' . plugin_basename( FEGP_FILE ), 'fegp_action_links' ); /** * Dismissible donation notice. */ function fegp_donate_notice() { $screen = get_current_screen(); if ( ! current_user_can( 'manage_options' ) || ! $screen || ! in_array( $screen->id, array( 'edit-sermons', 'sermons_page_feg-predigten', 'plugins' ), true ) ) { return; } if ( get_user_meta( get_current_user_id(), 'fegp_notice_dismissed', true ) ) { return; } $dismiss = wp_nonce_url( admin_url( 'admin-post.php?action=fegp_dismiss' ), 'fegp_dismiss' ); $html = '

' . esc_html__( 'Donate / Support', 'kanzelbuch' ) . '

' . fegp_donate_box() . '

' . esc_html__( 'Hide this notice', 'kanzelbuch' ) . '

'; echo wp_kses( $html, fegp_kses_allowed() ); } add_action( 'admin_notices', 'fegp_donate_notice' ); add_action( 'admin_post_fegp_dismiss', function () { check_admin_referer( 'fegp_dismiss' ); if ( current_user_can( 'manage_options' ) ) { update_user_meta( get_current_user_id(), 'fegp_notice_dismissed', 1 ); } wp_safe_redirect( wp_get_referer() ? wp_get_referer() : admin_url() ); exit; } );