403Webshell
Server IP : 69.72.244.102  /  Your IP : 216.73.216.164
Web Server : LiteSpeed
System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64
User : konzalta ( 1271)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/konzalta/johnweru.com/wp-content/plugins/rainbow-elements/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/konzalta/johnweru.com/wp-content/plugins/rainbow-elements/rainbow-elements.php
<?php
/**
 * Plugin Name: Rainbow Elements
 * Plugin URI: https://rainbowit.net/themes/inbio/
 * Description: Rainbow-Themes Elementor Elements Plugin for Required Inbio Theme
 * Version: 6.5
 * Author: Rainbow-Themes
 * Author URI: https://themeforest.net/user/rainbow-themes
 * Text Domain: rainbow-elements
 *
*/

if (!defined('ABSPATH')) exit;

add_action('after_setup_theme', 'inbio_theme_activation_check');

function inbio_theme_activation_check() {
    global $inbio_theme_active;
    $current_theme_slug = get_template();

    if ( 'inbio' != $current_theme_slug ) {
        $inbio_theme_active = false;
        return false; // Stop execution
    }

    $inbio_theme_active = true; // Theme is active
}


function rainbow_elements_plugin_load_textdomain() {
    load_plugin_textdomain('rainbow-elements', false, dirname(plugin_basename(__FILE__)) . '/languages');
}
add_action('init', 'rainbow_elements_plugin_load_textdomain');


if (!defined('RAINBOW_ELEMENTS')) {
    $plugin_data = get_file_data(__FILE__, array('version' => 'Version'));
    define('RAINBOW_ELEMENTS', $plugin_data['version']);
    define('RAINBOW_ELEMENTS_SCRIPT_VER', (WP_DEBUG) ? time() : RAINBOW_ELEMENTS);
    define('RAINBOW_ELEMENTS_THEME_PREFIX', 'rainbow');
    define('RAINBOW_PT_PREFIX', 'rainbow');
    define('RAINBOW_ELEMENTS_BASE_DIR', plugin_dir_path(__FILE__));

    defined('RAINBOW_ELEMENTS_ACTIVED') or define('RAINBOW_ELEMENTS_ACTIVED', (bool)function_exists('WC'));
    define('RAINBOW_ELEMENTS_BASE_URL', plugins_url('/', __FILE__));
    define('RAINBOW_CORE_URL', plugin_dir_url(__FILE__));
    define('RAINBOW_CORE_ASSETS', trailingslashit(RAINBOW_CORE_URL . 'assets'));
}

require_once plugin_dir_path(__FILE__) . 'elementor/helper.php';

if (!class_exists('Rainbow_Elements')) {

    class Rainbow_Elements
    {

        public $plugin = 'rainbow-elements';
        public $action = 'rainbow_theme_init';
        protected static $instance;

        public function __construct()
        {
        
            add_action($this->action, array($this, 'after_theme_loaded'));
            add_action('wp_ajax_nopriv_bio_protected_code', array($this, 'bio_protected_code_endpoint'));
            add_action('wp_ajax_bio_protected_code', array($this, 'bio_protected_code_endpoint'));
        }

        public static function instance()
        {
            if (null == self::$instance) {
                self::$instance = new self;
            }
            return self::$instance;
        }

        public function after_theme_loaded()
        {

            require_once(RAINBOW_ELEMENTS_BASE_DIR . 'lib/wp-svg/init.php'); // SVG support       
            require_once(RAINBOW_ELEMENTS_BASE_DIR . 'lib/navmenu-icon/init.php'); // Navmenu icon support
            require_once(RAINBOW_ELEMENTS_BASE_DIR . 'lib/feather-elements-icons.php'); // Navmenu icon support
            include_once(RAINBOW_ELEMENTS_BASE_DIR . '/include/custom-post.php');
            include_once(RAINBOW_ELEMENTS_BASE_DIR . '/include/social-share.php');
            include_once(RAINBOW_ELEMENTS_BASE_DIR . '/include/widgets/custom-widget-register.php');
            include_once(RAINBOW_ELEMENTS_BASE_DIR . '/include/allow-svg.php');
            include_once(RAINBOW_ELEMENTS_BASE_DIR . '/include/common-functions.php');

            if (did_action('elementor/loaded')) {
                require_once(RAINBOW_ELEMENTS_BASE_DIR . 'elementor/init.php'); // Elementor
                require_once(RAINBOW_ELEMENTS_BASE_DIR . 'elementor/helper.php'); // Elementor
            }
        }

       

        function bio_protected_code_endpoint()
        {

            $is_valid_nonce = wp_verify_nonce($_REQUEST['nonce'], 'bio-shortcode');
            if (!$is_valid_nonce) {
                wp_send_json(
                    [
                        'status'  => false,
                        'message' => 'Invalid nonce',
                    ]
                );
                exit;
            }

            $thumb_size = isset($_REQUEST['thumbnail_size']) ? $_REQUEST['thumbnail_size'] : '';
            $meta_display = isset($_REQUEST['meta_display']) ? $_REQUEST['meta_display'] : '';
            $projects_meta_display = isset($_REQUEST['projects_meta_display']) ? $_REQUEST['projects_meta_display'] : '';
            $like_text = isset($_REQUEST['like_text']) ? $_REQUEST['like_text'] : '';
            $like_this_txt = isset($_REQUEST['like_this_txt']) ? $_REQUEST['like_this_txt'] : '';
            $button_text = isset($_REQUEST['button_text']) ? $_REQUEST['button_text'] : '';
            $modal_button_txt = isset($_REQUEST['modal_button_txt']) ? $_REQUEST['modal_button_txt'] : '';
            $project_cat_display = isset($_REQUEST['project_cat_display']) ? $_REQUEST['project_cat_display'] : '';

            $modal_popup_display = isset($_REQUEST['modal_popup_display']) ? $_REQUEST['modal_popup_display'] : 'no';
            $layout_style = isset($_REQUEST['layout_style']) ? $_REQUEST['layout_style'] : '1';

            $post_id = $_REQUEST['bio-post-id'];

            $post_type           = get_post_type($post_id);
            $available_post_type = 'rainbow_projects';
            if ($available_post_type !== $post_type) {
                wp_send_json(
                    [
                        'status'  => false,
                        'message' => 'Not available post type',
                    ]
                );
                exit;
            }

            global $post;

            $post    = get_post($post_id);
            $content2 = apply_filters('the_content', $post->post_content);

            $post_data = array(
                'ID' => $post_id,
                'title' => $post->post_title,
                'content' => apply_filters('the_content', $post->post_content),
                'excerpt' => $post->post_excerpt,
                'slug' => $post->post_name,
                'date' => $post->post_date,
                'modified' => $post->post_modified,
                'status' => $post->post_status,
                'type' => $post->post_type,
                'author' => $post->post_author,
                'meta' => get_post_meta($post->ID),
            );

            $id = $_REQUEST['bio-post-id'];
            $modal_button_url = get_post_meta($id, 'popup_project_button_url', true);
            $like_this_txt = isset($like_this_txt) ? $like_this_txt : '';
            $modal_button_txt = isset($modal_button_txt) ? $modal_button_txt : '';



            $preview_type = rainbow_get_acf_data('preview_type');
            $preview_icon = 'feather-none';

            $video_url = rainbow_get_acf_data('video_url');
            $gallery = rainbow_get_acf_data('gallery');
            $custom_link = rainbow_get_acf_data('link_url');
            $view_project_button_url = rainbow_get_acf_data('popup_project_button_url');


            if ($preview_type == 'image') {
                $preview_icon = 'feather-image';
                $data_url = "";
            } elseif ($preview_type == 'video') {
                $preview_icon = 'feather-video';
                $data_url = rainbow_getEmbedUrl($video_url);
            } elseif ($preview_type == 'gallery') {
                $preview_icon = 'feather-grid';
                $data_url = "";
            } elseif ($preview_type == 'link') {
                $preview_icon = 'feather-external-link';
                $data_url = "";
            } else {
            }


            // A Custom Link
            if ($preview_type == 'link') {
                $card_link = $custom_link;
                $target =  true;
            } else {
                $card_link = get_the_permalink();
                $target =  false;
            }


            $rainbow_options = \Rainbow_Helper::rainbow_get_options();
            $popup_style = \Rainbow_Helper::rainbow_portfolio_popup_style();

            $popup_layout = $popup_style['project_popup_style'];

            if ($popup_layout == 'left') {
                $popup_col_class = "col-lg-6";
                $content_col_class = "col-md-12";
                $button_col_class = "col-md-12";
                $popup_image_size = "" !== $rainbow_options['rainbow_project_popup_image_size'] ? $rainbow_options['rainbow_project_popup_image_size'] : 'rainbow-thumbnail-lg';
            } elseif ($popup_layout == 'center') {
                $popup_col_class = "col-lg-12";
                $content_col_class = "col-md-9";
                $button_col_class = "col-md-3";
                $popup_image_size = "" !== $rainbow_options['rainbow_project_popup_image_size'] ? $rainbow_options['rainbow_project_popup_image_size'] : 'rainbow-thumbnail-single';;
            } elseif ($popup_layout == 'right') {
                $popup_col_class = "col-lg-6";
                $content_col_class = "col-md-12";
                $button_col_class = "col-md-12";
                $popup_image_size = "" !== $rainbow_options['rainbow_project_popup_image_size'] ? $rainbow_options['rainbow_project_popup_image_size'] : 'rainbow-thumbnail-lg';
            } else {
                $popup_col_class = 'col-lg-6';
                $content_col_class = "col-md-12";
                $button_col_class = "col-md-12";
                $popup_image_size = "" !== $rainbow_options['rainbow_project_popup_image_size'] ? $rainbow_options['rainbow_project_popup_image_size'] : 'rainbow-thumbnail-lg';
            }
            //  Add class
            $preview_type_class = ($preview_type) ? "preview-type-$preview_type" : false;



            $terms = get_the_terms($post_id, 'rainbow_projects_category');
            $termsAssignedCat = '';
            if ($terms && !is_wp_error($terms)) {
                $termsList = [];
                foreach ($terms as $category) {
                    $termsList[] = "rbt-" . $category->slug;
                }
                $termsAssignedCat = join(" ", $termsList);
            }

            $post = get_post($id);

            ob_start();

            if ($modal_popup_display == 'yes' && $preview_type != 'link') { ?>
                <div class="rn-portfolio portfolio-card-only-popup ">
                <?php } else { ?>
                    <div class="rn-portfolio ">
                    <?php } ?>
                    <div class="inner">
                        <span class="preview-type"><i class="<?php echo esc_attr($preview_icon); ?>"></i></span>

                        <?php if (has_post_thumbnail()) { ?>
                            <div class="thumbnail">
                                <?php if ($modal_popup_display == 'yes' && $preview_type != 'link') { ?>
                                    <a href="<?php echo esc_url($card_link); ?>" data-url="<?php echo esc_url($data_url); ?>" data-toggle="modal" data-target="#exampleModalCenter-<?php echo esc_attr($id); ?>"><?php the_post_thumbnail($thumb_size); ?></a>
                                <?php } else { ?>
                                    <a href="<?php echo esc_url($card_link); ?>" <?php if ($target) : ?> target="_blank" <?php endif; ?>>
                                        <?php the_post_thumbnail($thumb_size); ?>
                                    </a>
                                <?php } ?>
                            </div>
                        <?php } ?>
                        <div class="content">
                            <div class="category-info">

                                <?php if ($project_cat_display) { ?>
                                    <?php if ($modal_popup_display) { ?>
                                        <div class="category-list">
                                            <?php \rainbow\Rainbow_Elements\rainbow_Elements_Helper::get_projects_cat($post_id); ?>
                                        </div>
                                    <?php } else { ?>
                                        <div class="category-list">
                                            <?php \rainbow\Rainbow_Elements\rainbow_Elements_Helper::get_projects_cat($post_id); ?>
                                        </div>
                                    <?php } ?>
                                <?php } ?>

                                <?php if ($projects_meta_display) { ?>
                                    <?php
                                    global $post;
                                    $nonce2 = wp_create_nonce('rainbow_pt_like_it_nonce');
                                    $link2 = admin_url('admin-ajax.php?action=rainbow_pt_like_it&post_id=' . $_REQUEST['bio-post-id'] . '&nonce=' . $nonce2);
                                    $likes2 = get_post_meta($_REQUEST['bio-post-id'], '_pt_likes', true);
                                    $likes2 = (empty($likes2)) ? 0 : $likes2;
                                    ?>
                                    <div class="post-like pt-like-it meta">
                                        <span> <a class="like-button" href="<?php echo esc_url($link2); ?>" data-id="<?php echo esc_attr($_REQUEST['bio-post-id']); ?>" data-nonce="<?php echo esc_attr($nonce2); ?>">
                                                <i class="feather-heart"></i><span id="like-count-<?php echo $_REQUEST['bio-post-id']; ?>" class="like-count">
                                                    <?php $likes2 = ($likes2 == "0") ? "" : $likes2; ?>
                                                    <?php echo esc_html($likes2); ?>
                                                </span>
                                            </a></span>
                                    </div>

                                <?php } ?>
                            </div>
                            <h4 class="title">
                                <?php
                                if ($modal_popup_display == 'yes' && $preview_type != 'link') {

                                ?>
                                    <a href="<?php echo esc_url($card_link); ?>" data-url="<?php echo esc_url($data_url); ?>" data-toggle="modal" data-target="#exampleModalCenter-<?php echo esc_attr($post_id); ?>"><?php the_title(); ?>
                                        <i class="feather-arrow-up-right"></i></a>
                                <?php } else { ?>
                                    <a href="<?php echo esc_url($card_link); ?>" <?php if ($target) : ?> target="_blank" <?php endif; ?>><?php the_title(); ?> <i class="feather-arrow-up-right"></i></a>
                                <?php } ?>
                            </h4>
                        </div>
                    </div>
                    </div>
                    <?php if ($layout_style == '1' || 'archive' == $layout_style) { ?>
                        <!-- Modal Portfolio Body area Start -->
                        <div class="modal fade newportfolio-modal modal-layout-<?php echo esc_attr($popup_layout) ?>" id="exampleModalCenter-<?php echo esc_attr($post_id); ?>" tabindex="-1" role="dialog" aria-hidden="true" data-modalwrapper="portfolio-modal">
                            <div class="modal-dialog modal-dialog-centered" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                            <span aria-hidden="true"> <i class="feather-x"></i></span>
                                        </button>
                                    </div>
                                    <div class="modal-body">
                                        <div class="row align-items-center">
                                            <div class="<?php echo esc_attr($popup_col_class); ?>">
                                                <?php
                                                if ($preview_type == 'image') { ?>
                                                    <div class="portfolio-popup-thumbnail">
                                                        <?php if (has_post_thumbnail()) { ?>
                                                            <div class="image">
                                                                <?php the_post_thumbnail($popup_image_size); ?>
                                                            </div>
                                                        <?php } ?>
                                                    </div>
                                                    <?php } elseif ($preview_type == 'video') {
                                                    $row_video_src = '';
                                                    if (function_exists('rainbow_getEmbedUrl')) {
                                                        $row_video_src = rainbow_getEmbedUrl($video_url);
                                                    }
                                                    $video_ratio =  ($popup_layout == 'center') ? '16by9' : '4by3';
                                                    if (!empty($row_video_src)) { ?>
                                                        <div class="portfolio-popup-thumbnail">
                                                            <div class="embed-responsive embed-responsive-<?php echo esc_attr($video_ratio); ?>">
                                                                <iframe class="embed-responsive-item" 
                                                                        src="<?php echo esc_url($row_video_src . '?autoplay=0'); ?>" 
                                                                        allow="autoplay; fullscreen; picture-in-picture" 
                                                                        allowfullscreen>
                                                                </iframe>

                                                            </div>
                                                        </div>
                                                    <?php }
                                                } elseif ($preview_type == 'gallery') {
                                                    if ($gallery) { ?>
                                                        <div id="portfolio-modal-thumbnail-slider-<?php echo esc_attr($id); ?>" class="carousel slide" data-ride="carousel">
                                                            <div class="carousel-inner">
                                                                <?php
                                                                $r = 1;
                                                                foreach ($gallery as $image) :
                                                                    $inner_active = $r == 1 ? 'inner active' : null;
                                                                    $r++;
                                                                ?>
                                                                    <div class="carousel-item <?php echo esc_attr($inner_active); ?>">
                                                                        <img class="w-100" src="<?php echo esc_url($image['sizes'][$popup_image_size]); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
                                                                    </div>
                                                                <?php endforeach; ?>

                                                            </div>
                                                            <a class="carousel-control-prev" href="#portfolio-modal-thumbnail-slider-<?php echo esc_attr($id); ?>" role="button" data-slide="prev">
                                                                <span class="" aria-hidden="true"> <i class="feather-arrow-left"></i> </span>
                                                                <span class="sr-only"><?php esc_html__('Previous', 'rainbow-elements'); ?></span>
                                                            </a>
                                                            <a class="carousel-control-next" href="#portfolio-modal-thumbnail-slider-<?php echo esc_attr($id); ?>" role="button" data-slide="next">
                                                                <span class="" aria-hidden="true"> <i class="feather-arrow-right"></i> </span>
                                                                <span class="sr-only"><?php esc_html__('Next', 'rainbow-elements'); ?></span>
                                                            </a>
                                                        </div>
                                                        <?php } else {
                                                        if (has_post_thumbnail()) { ?>
                                                            <div class="portfolio-popup-thumbnail">
                                                                <?php if (has_post_thumbnail()) { ?>
                                                                    <div class="image">
                                                                        <?php the_post_thumbnail($popup_image_size); ?>
                                                                    </div>
                                                                <?php } ?>
                                                            </div>
                                                    <?php }
                                                    }
                                                } else { ?>
                                                    <div class="portfolio-popup-thumbnail">
                                                        <?php if (has_post_thumbnail()) { ?>
                                                            <div class="image">
                                                                <?php the_post_thumbnail($popup_image_size); ?>
                                                            </div>
                                                        <?php } ?>
                                                    </div>
                                                <?php } ?>
                                            </div>

                                            <div class="<?php echo esc_attr($popup_col_class); ?>">
                                                <div class="text-content">

                                                    <div class="row">
                                                        <div class="<?php echo esc_attr($content_col_class); ?>">
                                                            <h3> <?php the_title(); ?> </h3>

                                                            <?php
                                                            if (has_excerpt()) {
                                                                the_excerpt();
                                                            }
                                                            ?>

                                                            <?php
                                                            $info_list = rainbow_get_acf_data('information');
                                                            if ($info_list) { ?>
                                                                <div class="info-list">
                                                                    <ul>
                                                                        <?php
                                                                        foreach ($info_list as $info) { ?>
                                                                            <li><strong><?php echo esc_html($info['label']) ?></strong> <span><?php echo esc_html($info['value']) ?></span></li>
                                                                        <?php } ?>
                                                                    </ul>
                                                                </div>
                                                            <?php } ?>
                                                        </div>
                                                        <div class="<?php echo esc_attr($button_col_class); ?>">
                                                            <?php if ($popup_layout == 'center') { ?>
                                                                <div class="d-flex flex-wrap mt--20">
                                                                    <?php if ($projects_meta_display) { ?>
                                                                        <?php
                                                                        global $post;
                                                                        $nonce = wp_create_nonce('rainbow_pt_like_it_nonce');
                                                                        $link = admin_url('admin-ajax.php?action=rainbow_pt_like_it&post_id=' . $post->ID . '&nonce=' . $nonce);
                                                                        $likes = get_post_meta($_REQUEST['bio-post-id'], '_pt_likes', true);
                                                                        $likes = (empty($likes)) ? 0 : $likes;
                                                                        $likes_text = ($likes <= 1) ? $like_text : $like_text;
                                                                        ?>
                                                                        <div class="post-like pt-like-it w-100 mb--30">
                                                                            <a class="like-button rn-btn thumbs-icon rn-btn thumbs-icon w-100 text-center" href="<?php echo esc_url($link); ?>" data-id="<?php echo esc_attr($_REQUEST['bio-post-id']); ?>" data-nonce="<?php echo esc_attr($nonce); ?>">
                                                                                <span> <?php echo wp_kses_post($likes_text); ?> </span>
                                                                                <i class="feather-thumbs-up mr--10"></i>
                                                                                <mark id="like-count2-<?php echo $_REQUEST['bio-post-id']; ?>" class="like-count badge">
                                                                                    <?php echo esc_html($likes); ?>
                                                                                </mark>
                                                                            </a>
                                                                        </div>

                                                                    <?php } ?>

                                                                    <?php
                                                                    $vpbtn = '<a  href="' . $modal_button_url . '"  class="rn-btn w-100 text-center" target="_blank"> <span>' . wp_kses_post( $modal_button_txt ). '</span>  <i class="feather-arrow-right-circle"></i></a>';
                                                                    if (!empty($modal_button_url)) {
                                                                        echo wp_kses_post($vpbtn);
                                                                    }
                                                                    ?>

                                                                </div>
                                                            <?php } else { ?>
                                                                <div class="button-group d-flex flex-wrap mt--20">
                                                                    <?php if ($projects_meta_display) { ?>
                                                                        <?php
                                                                        global $post;
                                                                        $nonce = wp_create_nonce('rainbow_pt_like_it_nonce');
                                                                        $link = admin_url('admin-ajax.php?action=rainbow_pt_like_it&post_id=' . $_REQUEST['bio-post-id'] . '&nonce=' . $nonce);
                                                                        $likes = get_post_meta($_REQUEST['bio-post-id'], '_pt_likes', true);
                                                                        $likes = (empty($likes)) ? 0 : $likes;
                                                                        $likes_text = ($likes <= 1) ? $like_this_txt : $like_this_txt;
                                                                        ?>

                                                                        <div class="post-like pt-like-it">
                                                                            <a class="like-button rn-btn thumbs-icon rn-btn thumbs-icon" href="<?php echo esc_url($link); ?>" data-id="<?php echo esc_attr($_REQUEST['bio-post-id']); ?>" data-nonce="<?php echo esc_attr($nonce); ?>" target="_blank">
                                                                                <span> <?php echo wp_kses_post($likes_text); ?> </span>
                                                                                <i class="feather-thumbs-up mr--10"></i>
                                                                                <mark id="like-count2-<?php echo $_REQUEST['bio-post-id']; ?>" class="like-count badge">
                                                                                    <?php echo esc_html($likes); ?>
                                                                                </mark>
                                                                            </a>
                                                                        </div>


                                                                    <?php } ?>

                                                                    <?php
                                                                    $vpbtn = '<a  href="' . $modal_button_url . '"  class="rn-btn " target="_blank"> <span>' . wp_kses_post( $modal_button_txt ). '</span>  <i class="feather-arrow-right-circle"></i></a>';
                                                                    if (!empty($modal_button_url)) {
                                                                        echo wp_kses_post($vpbtn);
                                                                    }
                                                                    ?>

                                                                </div>
                                                            <?php } ?>
                                                        </div>
                                                    </div>

                                                </div>
                                                <!-- End of .text-content -->
                                            </div>

                                        </div>
                                        <!-- End of .row media-->
                                        <div class="row">
                                            <div class="col-md-12">
                                                <div class="rb-separator pb--30 pt--30">
                                                    <div class="divider-separator w-100"></div>
                                                </div>
                                                <?php
                                                $modal_template_id = $_REQUEST['bio-post-id'];
                                                if ('' != $modal_template_id) {
                                                    if (class_exists('Elementor\Plugin')) {
                                                        if ('' != $modal_template_id) {
                                                            $elementor = \Elementor\Plugin::instance();
                                                            $modal_content = $elementor->frontend->get_builder_content($modal_template_id, true);
                                                        }
                                                    }
                                                }
                                                if ('' != $modal_content || !empty($modal_content)) {
                                                    if (defined('ELEMENTOR_PATH') && class_exists('Elementor\Widget_Base')) {
                                                        if (!\Elementor\Plugin::$instance->preview->is_preview_mode()) {
                                                            echo rainbow_awescapeing($modal_content);
                                                        }
                                                    }
                                                } else {
                                                    echo wp_kses_post($content2);
                                                }
                                                ?>
                                            </div>
                                        </div>
                                        <!-- End of .row body-->
                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php } ?>

            <?php
            $content = ob_get_clean();
            wp_send_json(
                [
                    'status'          => true,
                    'isValidPassword' => inbio_validate_the_password_func(),
                    'content'         => $content,
                ]
            );

            exit;
        }
    }
}

Rainbow_Elements::instance();


add_filter('the_content', 'inbio_wrap_code_in_shortcode', 9);
function inbio_wrap_code_in_shortcode($content)
{
    $content = preg_replace('/(<pre[^>]*>\s*<code[^>]*>)/', "[protected]$1", $content);
    $content = preg_replace('/(<\/code>\s*<\/pre>)/', "$1[/protected]", $content);

    return $content;
}

add_shortcode('protected', 'inbio_password_protected_function');

function inbio_password_protected_function($atts, $content = null)
{

    if (inbio_validate_the_password_func()) {

        return do_shortcode($content);
    }
    $rainbow_options = \Rainbow_Helper::rainbow_get_options();

    $request_password_link  = isset($rainbow_options['projects_request_password_link']) ? $rainbow_options['projects_request_password_link']  : 'You want password? <a href="#" tabindex="0">Request Password</a>';
    $projects_password_protected_title_text = isset($rainbow_options['projects_password_protected_title_text']) ? $rainbow_options['projects_password_protected_title_text']  : 'Please enter the password to <br> view the content.';


    $atts = shortcode_atts(array(
        'post_id' => 0,
        'thumbnail_size' => '',
        'projects_meta_display' => '',
        'like_text' => '',
        'like_this_txt' => '',
        'button_text' => '',
        'modal_button_txt' => '',
        'project_cat_display' => '',
        'modal_popup_display' => '',
        'layout_style' => '',

    ), $atts, 'protected');


    $post_id                = intval($atts['post_id']);
    $thumbnail_size         = $atts['thumbnail_size'];
    $projects_meta_display  = $atts['projects_meta_display'];
    $like_text              = $atts['like_text'];
    $like_this_txt          = $atts['like_this_txt'];
    $button_text            = $atts['button_text'];
    $modal_button_txt       = $atts['modal_button_txt'];
    $project_cat_display    = $atts['project_cat_display'];
    $modal_popup_display    = $atts['modal_popup_display'];
    $layout_style    = $atts['layout_style'];

    $data_attribute = [
        'thumbnail_size'            => $thumbnail_size,
        'projects_meta_display'     => $projects_meta_display,
        'like_text'                 => $like_text,
        'like_this_txt'             => $like_this_txt,
        'button_text'               => $button_text,
        'modal_button_txt'          => $modal_button_txt,
        'project_cat_display'       => $project_cat_display,
        'post_id'                   => $post_id,
        'modal_popup_display'       => $modal_popup_display,
        'layout_style'              => $layout_style,

    ];

    $json_data = json_encode($data_attribute);
    $escaped_json_data = htmlspecialchars($json_data, ENT_QUOTES, 'UTF-8');

    ob_start();
    ?>
    <div class="bio-protected-content inbio-protected-content-main-wrapper">

        <div class="rbt-card-icon lg-icon">
            <i class="feather-unlock"></i>
        </div>
        <h6 class="password-submit-view-post"><?php echo wp_kses_post($projects_password_protected_title_text); ?></h6>
        <form method="post"  data-protectedpass="<?php echo esc_attr($escaped_json_data); ?>" class="inbio-portfolio-password">
            <input required type="password" placeholder="<?php echo esc_html__("Enter password","rainbow-elements");?>" name="password" class="userpass">
            <input  class="inbio-protect-submit-button" type="submit" value="<?php echo esc_html__("Let's Go","rainbow-elements");?>">
        </form>
        <div  class="inbio-errorPWdata"></div>
        <?php if(isset( $request_password_link) && !empty($request_password_link)) { ?>
        <p class="inbio-enter-protected-password"><?php echo wp_kses_post($request_password_link); ?></p>
        <?php } ?>

    </div>
    <?php

    return ob_get_clean();
}

function inbio_validate_the_password_func()
{
    $userpass   = $_REQUEST['password'] ?? $_COOKIE['userpass'] ?? null;
    $postid     = $_REQUEST['bio-post-id'] ?? '';
    $post       = get_post($postid);

    // Update the post object with the password
    $post_password = $post->post_password;

    return in_array($userpass, [$post_password]);
}


/**
 * Adds a notification bar to the footer of the website.
 *
 * This function retrieves options from Rainbow and displays a notification bar
 * with customizable elements if the chat availability is enabled.
 */
add_action("wp_footer", "inbio_notifications_bar");

function inbio_notifications_bar()
{

    $rainbow_options                         = Rainbow_Helper::rainbow_get_options();
    $rainbow_enable_chat_availability        = (isset($rainbow_options['rainbow_enable_chat_availability'])) ? $rainbow_options['rainbow_enable_chat_availability'] : 'no';
    $rainbow_notice_bar_heading_title        = (isset($rainbow_options['rainbow_notice_bar_heading_title'])) ? $rainbow_options['rainbow_notice_bar_heading_title'] : '';
    $rainbow_notice_bar_avilability_title    = (isset($rainbow_options['rainbow_notice_bar_avilability_title'])) ? $rainbow_options['rainbow_notice_bar_avilability_title'] : '';
    $rainbow_notice_bar_author_img           = (isset($rainbow_options['rainbow_notice_bar_author_img'])) ? $rainbow_options['rainbow_notice_bar_author_img'] : '';
    $rainbow_notice_bar_position             = (isset($rainbow_options['rainbow_notice_bar_position'])) ? $rainbow_options['rainbow_notice_bar_position'] : '';
    $rainbow_notice_bar_button_title         = (isset($rainbow_options['rainbow_notice_bar_button_title'])) ? $rainbow_options['rainbow_notice_bar_button_title'] : '';
    $rainbow_notice_bar_button_link          = (isset($rainbow_options['rainbow_notice_bar_button_link'])) ? $rainbow_options['rainbow_notice_bar_button_link'] : '';
    $rainbow_notice_bar_top_bottom_position  = (isset($rainbow_options['rainbow_notice_bar_top_bottom_position'])) ? $rainbow_options['rainbow_notice_bar_top_bottom_position'] : '';
    $notice_bar_theme_color  = (isset($rainbow_options['notice_bar_theme_color'])) ? $rainbow_options['notice_bar_theme_color'] : '';

    if ( $rainbow_enable_chat_availability == 'yes' ) {
    ?>
        <div id="inbio-notification-bar" class="inbio-notification-bar <?php echo esc_attr($rainbow_notice_bar_position); ?> <?php echo esc_attr($rainbow_notice_bar_top_bottom_position); ?> notificationbar-hidden <?php echo esc_attr( $notice_bar_theme_color ); ?> draggable">
        
            <?php if (isset($rainbow_notice_bar_author_img['url']) && !empty($rainbow_notice_bar_author_img['url'])) { ?>
                <img src="<?php echo esc_url($rainbow_notice_bar_author_img['url']); ?>" alt="Profile Picture" class="profile-pic">
            <?php } ?>
            <div class="inbio-notification-content">
                <h5 class="name"><?php echo wp_kses_post($rainbow_notice_bar_heading_title); ?></h5>
                <div class="inbio-availability"><?php echo wp_kses_post($rainbow_notice_bar_avilability_title); ?></div>
            </div>
            <a href="<?php echo esc_url($rainbow_notice_bar_button_link); ?>" class="rn-btn"><?php echo esc_html($rainbow_notice_bar_button_title); ?></a>
            <button class="inbio-close-button">&times;</button>
           
        </div>
    <?php
    }
}

/*inbio audio sound*/

/**
 * Adds an audio switcher to the footer of the website.
 *
 * This function checks if the user is logged in and retrieves the audio toggle state from
 * user meta or a cookie. It then displays a form with a toggle switch if audio is enabled
 * in the Rainbow options.
 */
function inbio_add_audio_switcher()
{

    if (is_user_logged_in()) {
        $inbio_audio_sound_active = get_user_meta(get_current_user_id(), 'inbio_audio_sound_active', true);
    } else {
        $inbio_audio_sound_active = isset($_COOKIE['inbio_audio_sound_active']) ? $_COOKIE['inbio_audio_sound_active'] : '';
    }

    $rainbow_options                = Rainbow_Helper::rainbow_get_options();
    $rainbow_enable_audio_sound     = (isset($rainbow_options['rainbow_enable_audio_sound'])) ? $rainbow_options['rainbow_enable_audio_sound'] : 'no';
    $rainbow_sound_volume_position  = (isset($rainbow_options['rainbow_sound_volume_position'])) ? $rainbow_options['rainbow_sound_volume_position'] : '';

    if( $rainbow_enable_audio_sound == 'yes' ) {
    ?>
    <form action="" method="post" class="inbio-audio-enable <?php echo esc_attr( $rainbow_sound_volume_position ); ?>">
        <div id="inbio-audio-switcher" class="inbio-audio-switcher">
            <label class="inbio-audio-switch">
                <input type="checkbox" id="inbio-audio-toggle" class="inbio-audio-toggle" value="1" <?php echo ($inbio_audio_sound_active == '1') ? 'checked="checked"' : ''; ?>>
                <span class="inbio-audio-slider inbio-audio-round"></span>
                <span id="inbio-audio-label" class="inbio-audio-label"><i class="feather-volume-2 inbio-volume-change"></i></span>
            </label>
        </div>
    </form>
<?php
    }
}

add_action('wp_footer', 'inbio_add_audio_switcher');


/**
 * Handles the saving of the audio toggle state.
 *
 * This function is called via an AJAX request and saves the audio toggle state
 * in user meta if the user is logged in, or in a cookie if the user is not logged in.
 * It checks if audio is enabled in the Rainbow options before performing any action.
 */
function inbio_save_audio_toggle_state()
{
    // Verify nonce
    $nonce = isset($_POST['nonce']) ? $_POST['nonce'] : '';
    if (!wp_verify_nonce($nonce, 'inbio_audio_nonce')) {
        wp_send_json_error('Invalid nonce');
        wp_die();
    }
    $rainbow_options = Rainbow_Helper::rainbow_get_options();
    // Get the state from the AJAX request
    $audioStatus = isset($_POST['audioStatus']) ? sanitize_text_field($_POST['audioStatus']) : '';

    $rainbow_enable_audio_sound  = (isset($rainbow_options['rainbow_enable_audio_sound'])) ? $rainbow_options['rainbow_enable_audio_sound'] : 'no';
    
    if( $rainbow_enable_audio_sound == 'yes') {

        if (is_user_logged_in()) {
            update_user_meta(get_current_user_id(), 'inbio_audio_sound_active', $audioStatus);
        } else {
            setcookie('inbio_audio_sound_active', $audioStatus, time() + (86400 * 2), '/'); // 2 days cookie
        }

        wp_send_json(
            [
                'audio_state' => $audioStatus,
            ]
        );

    }

    exit();
}

add_action('wp_ajax_inbio_save_audio_toggle_state', 'inbio_save_audio_toggle_state');
add_action('wp_ajax_nopriv_inbio_save_audio_toggle_state', 'inbio_save_audio_toggle_state');


add_action("init","inbio_projects_post_reset_count");

function inbio_projects_post_reset_count() {
    $rainbow_options = Rainbow_Helper::rainbow_get_options();
    $rainbow_project_reset_link_count  = (isset($rainbow_options['rainbow_project_reset_link_count'])) ? $rainbow_options['rainbow_project_reset_link_count'] : 'no';

    if( is_array( $rainbow_project_reset_link_count ) || is_object($rainbow_project_reset_link_count ) ) {
        foreach( $rainbow_project_reset_link_count as $post_id ) {
            $meta_key = '_pt_likes'; // Meta key you want to delete
            delete_post_meta($post_id, $meta_key);
        }
    }
}


function inbio_plugin_activation_function() {
    update_option('elementor_container_width', '1320'); //update database
}

register_activation_hook(__FILE__, 'inbio_plugin_activation_function');

Youez - 2016 - github.com/yon3zu
LinuXploit