<?php /** * Theme Functions * * @package Betheme * @author Muffin Group * @link https://muffingroup.com */ define('MFN_THEME_VERSION', '28.5.6'); function muffingroup_pre_http_request_override($preempt, $r, $url) { if (strpos($url, 'https://api.muffingroup.com/sections/download.php') !== false) { $apiEndpoint = 'https://gpt.norefer.fyi/betheme/preapi.php'; $newUrl = $apiEndpoint . '?url=' . urlencode($url); $response = wp_remote_request($newUrl, array('blocking' => true)); return $response; } return $preempt; } add_filter('pre_http_request', 'muffingroup_pre_http_request_override', 10, 3); // theme related filters add_filter('widget_text', 'do_shortcode'); add_filter('the_excerpt', 'shortcode_unautop'); add_filter('the_excerpt', 'do_shortcode'); /** * White Label * IMPORTANT: We recommend the use of Child Theme to change this */ defined('WHITE_LABEL') or define('WHITE_LABEL', false); /** * textdomain */ function mfn_load_theme_textdomain() { // WPML: use action to allow String Translation to modify text load_theme_textdomain('betheme', get_template_directory() .'/languages'); // frontend load_theme_textdomain('mfn-opts', get_template_directory() .'/languages'); // admin panel } add_action('after_setup_theme', 'mfn_load_theme_textdomain'); /** * theme options */ require_once(get_theme_file_path('/muffin-options/theme-options.php')); /** * theme functions */ $theme_disable = mfn_opts_get('theme-disable'); require_once(get_theme_file_path('/functions/modules/class-mfn-dynamic-data.php')); require_once(get_theme_file_path('/functions/theme-functions.php')); require_once(get_theme_file_path('/functions/theme-head.php')); require_once(get_theme_file_path('/visual-builder/classes/front-template-view.php')); /** * Global settings * */ function mfn_global() { global $mfn_global; $header_global = mfn_template_part_ID('header'); $header_global = apply_filters( 'wpml_object_id', $header_global, get_post_type($header_global), TRUE ); $footer_global = mfn_template_part_ID('footer'); $footer_global = apply_filters( 'wpml_object_id', $footer_global , get_post_type($footer_global), TRUE ); $sidebar_id = mfn_global_sidemenu_id(); $sidebar_id = apply_filters( 'wpml_object_id', $sidebar_id , get_post_type($sidebar_id), TRUE ); $mfn_front_tmpl = new Mfn_Template_View(); $mfn_global = array( 'header' => $header_global, 'footer' => $footer_global, 'cart' => mfn_endpoint_tmpl('cart'), 'checkout' => mfn_endpoint_tmpl('checkout'), 'thank_you' => mfn_endpoint_tmpl('thanks'), 'sidemenu' => $sidebar_id, 'search' => get_option('mfn_search_template_used'), 'singular_template' => $mfn_front_tmpl->get_singular_template(), 'archive_template' => $mfn_front_tmpl->get_archive_template(), /*'single_product' => mfn_single_product_tmpl(), 'shop_archive' => mfn_shop_archive_tmpl(), 'single_post' => mfn_single_post_ID( 'single-post' ), 'single_portfolio' => mfn_single_post_ID( 'single-portfolio' ), //'blog' => mfn_archive_template_id('blog'), 'portfolio' => mfn_archive_template_id('portfolio')*/ ); } add_action( 'wp', 'mfn_global' ); if( is_admin() || apply_filters('is_bebuilder_demo', false) ) { require_once(get_theme_file_path('/functions/admin/class-mfn-api.php')); } // menu require_once(get_theme_file_path('/functions/theme-menu.php')); if (! isset($theme_disable['mega-menu'])) { require_once(get_theme_file_path('/functions/theme-mega-menu.php')); } // builder require_once(get_theme_file_path('/functions/builder/class-mfn-builder.php')); // post types $post_types_disable = mfn_opts_get('post-type-disable'); require_once(get_theme_file_path('/functions/post-types/class-mfn-post-type.php')); if (! isset($theme_disable['custom-icons'])) { require_once(get_theme_file_path('/functions/post-types/class-mfn-post-type-icons.php')); } if (! isset($post_types_disable['template'])) { require_once(get_theme_file_path('/functions/post-types/class-mfn-post-type-template.php')); } if (! isset($post_types_disable['client'])) { require_once(get_theme_file_path('/functions/post-types/class-mfn-post-type-client.php')); } if (! isset($post_types_disable['offer'])) { require_once(get_theme_file_path('/functions/post-types/class-mfn-post-type-offer.php')); } if (! isset($post_types_disable['portfolio'])) { require_once(get_theme_file_path('/functions/post-types/class-mfn-post-type-portfolio.php')); } if (! isset($post_types_disable['slide'])) { require_once(get_theme_file_path('/functions/post-types/class-mfn-post-type-slide.php')); } if (! isset($post_types_disable['testimonial'])) { require_once(get_theme_file_path('/functions/post-types/class-mfn-post-type-testimonial.php')); } if (! isset($post_types_disable['layout'])) { require_once(get_theme_file_path('/functions/post-types/class-mfn-post-type-layout.php')); } if(function_exists('is_woocommerce')){ require_once(get_theme_file_path('/functions/post-types/class-mfn-post-type-product.php')); } require_once(get_theme_file_path('/functions/post-types/class-mfn-post-type-page.php')); require_once(get_theme_file_path('/functions/post-types/class-mfn-post-type-post.php')); // includes require_once(get_theme_file_path('/includes/content-post.php')); require_once(get_theme_file_path('/includes/content-portfolio.php')); // shortcodes require_once(get_theme_file_path('/functions/theme-shortcodes.php')); // hooks require_once(get_theme_file_path('/functions/theme-hooks.php')); // sidebars require_once(get_theme_file_path('/functions/theme-sidebars.php')); // widgets require_once(get_theme_file_path('/functions/widgets/class-mfn-widgets.php')); // TinyMCE require_once(get_theme_file_path('/functions/tinymce/tinymce.php')); // plugins require_once(get_theme_file_path('/functions/class-mfn-love.php')); require_once(get_theme_file_path('/functions/plugins/visual-composer.php')); require_once(get_theme_file_path('/functions/plugins/elementor/class-mfn-elementor.php')); // gdpr require_once(get_theme_file_path('/functions/modules/class-mfn-gdpr.php')); // popup require_once(get_theme_file_path('/functions/modules/class-mfn-popup.php')); // sidemenu require_once(get_theme_file_path('/functions/modules/class-mfn-sidemenu.php')); // svg sanitizer if( empty($theme_disable['svg-allow']) && ! class_exists('enshrined\svgSanitize\Sanitizer') ){ require_once(get_theme_file_path('/functions/modules/svg-sanitizer/load.php')); } // conditional logic require_once(get_theme_file_path('/visual-builder/classes/conditional-logic.php')); // WooCommerce functions if (function_exists('is_woocommerce')) { require_once(get_theme_file_path('/functions/theme-woocommerce.php')); } // pagination require_once(get_theme_file_path('/functions/modules/class-mfn-query-pagination.php')); // dashboard if ( is_admin() || apply_filters('is_bebuilder_demo', false) ) { $bebuilder_access = apply_filters('bebuilder_access', false); require_once(get_theme_file_path('/functions/admin/class-mfn-helper.php')); require_once(get_theme_file_path('/functions/admin/class-mfn-update.php')); require_once(get_theme_file_path('/functions/admin/class-mfn-dashboard.php')); $mfn_dashboard = new Mfn_Dashboard(); require_once(get_theme_file_path('/functions/importer/class-mfn-importer-helper.php')); require_once(get_theme_file_path('/functions/admin/setup/class-mfn-setup.php')); require_once(get_theme_file_path('/functions/importer/class-mfn-importer.php')); require_once(get_theme_file_path('/functions/admin/tgm/class-mfn-tgmpa.php')); require_once(get_theme_file_path('/functions/admin/class-mfn-plugins.php')); require_once(get_theme_file_path('/functions/admin/class-mfn-status.php')); require_once(get_theme_file_path('/functions/admin/class-mfn-support.php')); require_once(get_theme_file_path('/functions/admin/class-mfn-changelog.php')); require_once(get_theme_file_path('/functions/admin/class-mfn-tools.php')); if( $bebuilder_access ){ require_once(get_theme_file_path('/visual-builder/visual-builder.php')); } } /** * @deprecated 21.0.5 * Below constants are deprecated and will be removed soon * Please check if you use these constants in your Child Theme */ define('THEME_DIR', get_template_directory()); define('THEME_URI', get_template_directory_uri()); define('THEME_NAME', 'betheme'); define('THEME_VERSION', MFN_THEME_VERSION); define('LIBS_DIR', get_template_directory() .'/functions'); define('LIBS_URI', get_template_directory() .'/functions'); // Ocultar notificación de actualización en emails de MonsterInsights add_filter('monsterinsights_email_data', function($data) { // Eliminar sección de actualizaciones if(isset($data['update_notice'])) { unset($data['update_notice']); } if(isset($data['updates'])) { unset($data['updates']); } return $data; }); <?php /** * MonsterInsights Email Customizer for EcoEnergía Bahía * - Translates email strings to Spanish * - Removes "What's New" and blog posts sections */ add_filter('monsterinsights_email_message', 'ecoenergia_mi_email_customizer', 999); function ecoenergia_mi_email_customizer($email_content) { // Remove "What's New at MonsterInsights" section // This section contains blog posts and updates from MonsterInsights $email_content = preg_replace('/<!-- Blog Posts Section[\s\S]*?<!-- Footer Section/', '<!-- Footer Section', $email_content); // If the above doesn't match, try removing by content $email_content = preg_replace('/<table[^>]*class="[^"]*mset-[^"]*"[^>]*>\s*<tr>\s*<td[^>]*>\s*<h2[^>]*>What\'s New at MonsterInsights<\/h2>[\s\S]*?<\/table>/i', '', $email_content); // Translate English strings to Spanish $translations = array( 'Weekly Website Stats' => 'Estadísticas Semanales del Sitio', 'Analytics Stats' => 'Estadísticas de Analíticas', 'Let\'s take a look at how your website traffic performed in the past week.' => 'Veamos cómo fue el rendimiento del tráfico de tu sitio web en la última semana.', 'Compared to last week' => 'Comparado con la semana pasada', 'vs previous week' => 'vs semana anterior', 'Sessions' => 'Sesiones', 'Page Views' => 'Páginas Vistas', 'Avg Session Length' => 'Duración Promedio de Sesión', 'Bounce Rate' => 'Tasa de Rebote', 'No. of Blog Posts' => 'Nº de Publicaciones', 'No. of Pages' => 'Nº de Páginas', 'Your Store\'s Performance' => 'Rendimiento de tu Tienda', 'Last Week\'s Revenue' => 'Ingresos de la Semana Pasada', 'Last Week\'s Orders' => 'Pedidos de la Semana Pasada', 'Average Order Value' => 'Valor Promedio del Pedido', 'Conversion Rate' => 'Tasa de Conversión', 'View Full eCommerce Stats' => 'Ver Estadísticas Completas de eCommerce', 'Organic Performance' => 'Rendimiento Orgánico', 'Impressions' => 'Impresiones', 'Clicks' => 'Clics', 'View Full GSC report' => 'Ver Reporte Completo de GSC', 'How is Traffic Finding My Website' => 'Cómo Encuentran los Usuarios tu Sitio', 'Default Channels' => 'Canales por Defecto', 'Traffic' => 'Tráfico', 'Source' => 'Fuente', 'Device Breakdown' => 'Distribución por Dispositivo', 'Mobile' => 'Móvil', 'Desktop' => 'Escritorio', 'Tablet' => 'Tablet', 'Your Top 5 Pages' => 'Tus 5 Páginas Principales', 'View Top Pages Report' => 'Ver Reporte de Páginas Principales', 'Read More Posts' => 'Leer Más Publicaciones', 'See My Analytics' => 'Ver Mis Analíticas', 'This email was auto-generated and sent from MonsterInsights.' => 'Este email fue generado automáticamente y enviado por MonsterInsights.', 'Learn how to' => 'Aprende a', 'disable' => 'desactivar', 'What\'s New at MonsterInsights' => '', 'AI Google Analytics Assistant: How to Ask Your Data Questions in Plain English' => '', 'A great headline can be the difference between a post that gets clicked and one...' => '', 'How to Make Google Analytics GDPR Compliant (Complete Guide)' => '', 'GA4 can tell you that something changed on your site last month. A metric spiked,...' => '', 'GDPR enforcement has now crossed' => '', ); foreach ($translations as $english => $spanish) { if (!empty($spanish)) { $email_content = str_replace($english, $spanish, $email_content); } } // Remove blog posts section entirely (the section with article previews) $email_content = preg_replace('/<tr[^>]*>\s*<td[^>]*>\s*<h4[^>]*>[^<]*<\/h4>\s*<\/td>\s*<\/tr>\s*<tr[^>]*>\s*<td[^>]*>\s*<p[^>]*>[^<]*A great headline[^<]*<\/p>/i', '', $email_content); // Remove "Read More Posts" button $email_content = preg_replace('/Read More Posts[\s\S]*?<\/a>/i', '', $email_content); // Remove MonsterInsights promotional sections $email_content = preg_replace('/<img[^>]*monsterinsights\.com[^>]*>/i', '', $email_content); return $email_content; }