File: /home/clinicamaciel/www/wp-content/themes/chocorocco/plugins/elegro-payment/elegro-payment.php
<?php
/* elegro Crypto Payment support functions
------------------------------------------------------------------------------- */
// Theme init priorities:
// 9 - register other filters (for installer, etc.)
if ( ! function_exists( 'chocorocco_elegro_payment_theme_setup9' ) ) {
add_action( 'after_setup_theme', 'chocorocco_elegro_payment_theme_setup9', 9 );
function chocorocco_elegro_payment_theme_setup9() {
if ( chocorocco_exists_elegro_payment() ) {
add_action('wp_enqueue_scripts', 'chocorocco_elegro_payment_frontend_scripts', 1100);
add_filter( 'chocorocco_filter_merge_styles', 'chocorocco_elegro_payment_merge_styles' );
}
if ( is_admin() ) {
add_filter( 'chocorocco_filter_tgmpa_required_plugins', 'chocorocco_elegro_payment_tgmpa_required_plugins' );
}
}
}
// Filter to add in the required plugins list
if ( ! function_exists( 'chocorocco_elegro_payment_tgmpa_required_plugins' ) ) {
function chocorocco_elegro_payment_tgmpa_required_plugins( $list = array() ) {
if (in_array('elegro-payment', chocorocco_storage_get('required_plugins'))) {
$list[] = array(
'name' => esc_html__('elegro Crypto Payment', 'chocorocco'),
'slug' => 'elegro-payment',
'required' => false,
);
}
return $list;
}
}
// Check if this plugin installed and activated
if ( ! function_exists( 'chocorocco_exists_elegro_payment' ) ) {
function chocorocco_exists_elegro_payment() {
return class_exists( 'WC_Elegro_Payment' );
}
}
// Merge custom styles
if ( ! function_exists( 'chocorocco_elegro_payment_merge_styles' ) ) {
function chocorocco_elegro_payment_merge_styles( $list ) {
$list[] = 'plugins/elegro-payment/elegro-payment.css';
return $list;
}
}
// Enqueue custom styles
if (!function_exists('chocorocco_elegro_payment_frontend_scripts')) {
function chocorocco_elegro_payment_frontend_scripts()
{
if (chocorocco_exists_elegro_payment()) {
if (chocorocco_is_on(chocorocco_get_theme_option('debug_mode')) && chocorocco_get_file_dir('plugins/elegro-payment/elegro-payment.css') != '')
wp_enqueue_style('chocorocco-elegro-payment', chocorocco_get_file_url('plugins/elegro-payment/elegro-payment.css'), array(), null);
}
}
}