| Linux webm007.cluster106.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 Path : /home/e/g/l/eglisebaa/www/wp-content/themes/hallelujah/plugins/give/ |
| Current File : /home/e/g/l/eglisebaa/www/wp-content/themes/hallelujah/plugins/give/give.php |
<?php
/* Give (donation forms) support functions
------------------------------------------------------------------------------- */
// Theme init priorities:
// 1 - register filters, that add/remove lists items for the Theme Options
if ( ! function_exists( 'hallelujah_give_theme_setup1' ) ) {
add_action( 'after_setup_theme', 'hallelujah_give_theme_setup1', 1 );
function hallelujah_give_theme_setup1() {
add_filter( 'hallelujah_filter_list_sidebars', 'hallelujah_give_list_sidebars' );
add_filter( 'hallelujah_filter_detect_blog_mode', 'hallelujah_give_detect_blog_mode' );
}
}
// Theme init priorities:
// 3 - add/remove Theme Options elements
if ( ! function_exists( 'hallelujah_give_theme_setup3' ) ) {
add_action( 'after_setup_theme', 'hallelujah_give_theme_setup3', 3 );
function hallelujah_give_theme_setup3() {
if ( hallelujah_exists_give() ) {
// Section 'Give Donation'
hallelujah_storage_merge_array(
'options', '', array_merge(
array(
'give' => array(
'title' => esc_html__( 'Give Donation', 'hallelujah' ),
'desc' => wp_kses_data( __( 'Select parameters to display the community pages', 'hallelujah' ) ),
'type' => 'section',
),
),
hallelujah_options_get_list_cpt_options( 'give' )
)
);
}
}
}
// Theme init priorities:
// 9 - register other filters (for installer, etc.)
if ( ! function_exists( 'hallelujah_give_theme_setup9' ) ) {
add_action( 'after_setup_theme', 'hallelujah_give_theme_setup9', 9 );
function hallelujah_give_theme_setup9() {
if ( hallelujah_exists_give() ) {
add_action( 'wp_enqueue_scripts', 'hallelujah_give_frontend_scripts', 1100 );
add_action( 'wp_enqueue_scripts', 'hallelujah_give_responsive_styles', 2000 );
add_filter( 'hallelujah_filter_merge_styles', 'hallelujah_give_merge_styles' );
add_filter('hallelujah_filter_merge_styles_responsive', 'hallelujah_give_merge_styles_responsive');
add_filter( 'hallelujah_filter_post_type_taxonomy', 'hallelujah_give_post_type_taxonomy', 10, 2 );
add_filter( 'hallelujah_filter_get_post_categories', 'hallelujah_give_get_post_categories', 10, 2 );
}
if ( is_admin() ) {
add_filter( 'hallelujah_filter_tgmpa_required_plugins', 'hallelujah_give_tgmpa_required_plugins' );
}
}
}
// Filter to add in the required plugins list
if ( ! function_exists( 'hallelujah_give_tgmpa_required_plugins' ) ) {
//Handler of the add_filter('hallelujah_filter_tgmpa_required_plugins', 'hallelujah_give_tgmpa_required_plugins');
function hallelujah_give_tgmpa_required_plugins( $list = array() ) {
if ( hallelujah_storage_isset( 'required_plugins', 'give' ) && hallelujah_storage_get_array( 'required_plugins', 'give', 'install' ) !== false ) {
$list[] = array(
'name' => hallelujah_storage_get_array( 'required_plugins', 'give', 'title' ),
'slug' => 'give',
'required' => false,
);
}
return $list;
}
}
// Check if plugin installed and activated
if ( ! function_exists( 'hallelujah_exists_give' ) ) {
function hallelujah_exists_give() {
return class_exists( 'Give' );
}
}
// Return true, if current page is any give page
if ( ! function_exists( 'hallelujah_is_give_page' ) ) {
function hallelujah_is_give_page() {
$rez = false;
if ( hallelujah_exists_give() ) {
$rez = is_give_form() || is_singular( 'give_forms' ) || is_give_category() || is_give_tag() || is_give_taxonomy();
}
return $rez;
}
}
// Detect current blog mode
if ( ! function_exists( 'hallelujah_give_detect_blog_mode' ) ) {
//Handler of the add_filter( 'hallelujah_filter_detect_blog_mode', 'hallelujah_give_detect_blog_mode' );
function hallelujah_give_detect_blog_mode( $mode = '' ) {
if ( hallelujah_is_give_page() ) {
$mode = 'give';
}
return $mode;
}
}
// Return taxonomy for current post type
if ( ! function_exists( 'hallelujah_give_post_type_taxonomy' ) ) {
//Handler of the add_filter( 'hallelujah_filter_post_type_taxonomy', 'hallelujah_give_post_type_taxonomy', 10, 2 );
function hallelujah_give_post_type_taxonomy( $tax = '', $post_type = '' ) {
if ( 'give_forms' == $post_type ) {
$tax = 'give_forms_category';
}
return $tax;
}
}
// Show categories
if ( ! function_exists( 'hallelujah_give_get_post_categories' ) ) {
//Handler of the add_filter( 'hallelujah_filter_get_post_categories', 'hallelujah_give_get_post_categories');
function hallelujah_give_get_post_categories( $cats = '' ) {
if ( get_post_type() == 'give_forms' ) {
$cats = hallelujah_get_post_terms( ', ', get_the_ID(), 'give_forms_category' );
}
return $cats;
}
}
// Enqueue styles for frontend
if ( ! function_exists( 'hallelujah_give_frontend_scripts' ) ) {
//Handler of the add_action( 'wp_enqueue_scripts', 'hallelujah_give_frontend_scripts', 1100 );
function hallelujah_give_frontend_scripts() {
if ( hallelujah_is_on( hallelujah_get_theme_option( 'debug_mode' ) ) ) {
$hallelujah_url = hallelujah_get_file_url( 'plugins/give/give.css' );
if ( '' != $hallelujah_url ) {
wp_enqueue_style( 'hallelujah-give', $hallelujah_url, array(), null );
}
}
}
}
// Enqueue responsive styles
if ( ! function_exists( 'hallelujah_give_responsive_styles' ) ) {
//Handler of the add_action( 'wp_enqueue_scripts', 'hallelujah_give_responsive_styles', 2000 );
function hallelujah_give_responsive_styles() {
if ( hallelujah_is_on( hallelujah_get_theme_option( 'debug_mode' ) ) ) {
$hallelujah_url = hallelujah_get_file_url( 'plugins/give/give-responsive.css' );
if ( '' != $hallelujah_url ) {
wp_enqueue_style( 'hallelujah-give-responsive', $hallelujah_url, array(), null );
}
}
}
}
// Merge custom styles
if ( ! function_exists( 'hallelujah_give_merge_styles' ) ) {
//Handler of the add_filter('hallelujah_filter_merge_styles', 'hallelujah_give_merge_styles');
function hallelujah_give_merge_styles( $list ) {
$list[] = 'plugins/give/give.css';
return $list;
}
}
// Merge responsive styles
if ( ! function_exists( 'hallelujah_give_merge_styles_responsive' ) ) {
//Handler of the add_filter('hallelujah_filter_merge_styles_responsive', 'hallelujah_give_merge_styles_responsive');
function hallelujah_give_merge_styles_responsive( $list ) {
$list[] = 'plugins/give/give-responsive.css';
return $list;
}
}
// Add Give specific items into lists
//------------------------------------------------------------------------
// Add sidebar
if ( ! function_exists( 'hallelujah_give_list_sidebars' ) ) {
//Handler of the add_filter( 'hallelujah_filter_list_sidebars', 'hallelujah_give_list_sidebars' );
function hallelujah_give_list_sidebars( $list = array() ) {
$list['give_widgets'] = array(
'name' => esc_html__( 'Give Widgets', 'hallelujah' ),
'description' => esc_html__( 'Widgets to be shown on the Give pages', 'hallelujah' ),
);
return $list;
}
}
// Add plugin-specific colors and fonts to the custom CSS
if ( hallelujah_exists_give() ) {
require_once HALLELUJAH_THEME_DIR . 'plugins/give/give-styles.php'; }