HEX
Server: Apache
System: Linux ecngx285.inmotionhosting.com 4.18.0-553.79.1.lve.el8.x86_64 #1 SMP Wed Oct 15 17:59:35 UTC 2025 x86_64
User: zeusxp5 (3862)
PHP: 8.3.28
Disabled: NONE
Upload Files
File: /home/zeusxp5/chuair.org/wp-content/plugins/wd-framework/wd-framework.php
<?php 

/**
 * Plugin Name: Webdevia Framework
 * Plugin URI: http://www.webdevia.com
 * Description: Add features to Webdevia themes.
 * Version: 5.1.3
 * Author: Mymoun
 * Author URI: http://www.themeforest.net/user/Mymoun
 * Text Domain: wd-framework
 */

if( ! defined( 'ABSPATH' ) ) {
  return;
}

define( 'WD_MAIN_PLUGIN', __FILE__ );
define( 'WD_MAIN_PLUGIN_PATH', wp_normalize_path( plugin_dir_path( __FILE__ ) . DIRECTORY_SEPARATOR ) );
define( 'WD_MAIN_PLUGIN_URI',  plugin_dir_url( __FILE__ ) );
define( 'WD_MAIN_PLUGIN_SLUG', "wdmp_" );

$theme_data = wp_get_theme()->parent() ? wp_get_theme()->parent() : wp_get_theme();
define( 'WD_MAIN_PLUGIN_THEME_SLUG', $theme_data->get( 'TextDomain' ));

require_once(  WD_MAIN_PLUGIN_PATH .'includes/singleton.php' );
class WebdeviaFramework {

  private $endpoint;
  private $customFields;

    use \Webdevia\Main_Plugin\Singleton;
  function __construct() {

    require_once(  WD_MAIN_PLUGIN_PATH .'includes/installer.php' );

    $this->load_dependencies();
    $this->admin_hooks();
    $this->public_hooks();
  }

  private function load_dependencies() {

    require_once WD_MAIN_PLUGIN_PATH .'includes/helper.php';
    require_once WD_MAIN_PLUGIN_PATH .'post-types.php';
    require WD_MAIN_PLUGIN_PATH . 'includes/hooks.class.php';
    
    require_once WD_MAIN_PLUGIN_PATH .'includes/endpoint.php';
    require_once WD_MAIN_PLUGIN_PATH .'includes/block-editor/blocks.php';
    require_once WD_MAIN_PLUGIN_PATH .'includes/block-editor/class-blocks-css.php';

    require_once WD_MAIN_PLUGIN_PATH .'/import/wd-import.php';
    
    if( wdmp_custom_field_authorized() ) {
      include_once WD_MAIN_PLUGIN_PATH . 'admin/custom-fields.php';
      $this->customFields = \Webdevia\Main_Plugin\CustomFields::instance();
  
      include_once WD_MAIN_PLUGIN_PATH . 'admin/field.php';
      include_once WD_MAIN_PLUGIN_PATH . 'admin/panel/panel.php';
      include_once WD_MAIN_PLUGIN_PATH . 'admin/metaboxes/custom-fields-metabox.php';
  
      require_once WD_MAIN_PLUGIN_PATH . 'includes/endpoints/endpoint-get-portfolios.php';
      $this->endpoint = new \Webdevia\Main_Plugin\Endpoint_Get_Portfolios();
  
      require_once WD_MAIN_PLUGIN_PATH . 'includes/endpoints/custom-fields/endpoint-add-custom-field.php';
      $this->endpoint = new \Webdevia\Main_Plugin\Endpoint_Add_Custom_Field();
      
      require_once WD_MAIN_PLUGIN_PATH . 'includes/endpoints/custom-fields/endpoint-edit-custom-field.php';
      $this->endpoint = new \Webdevia\Main_Plugin\Endpoint_Edit_Custom_Field();    
      
      require_once WD_MAIN_PLUGIN_PATH . 'includes/endpoints/custom-fields/endpoint-get-custom-fields.php';
      $this->endpoint = new \Webdevia\Main_Plugin\Endpoint_Get_Custom_Fields();

      require_once WD_MAIN_PLUGIN_PATH . 'includes/endpoints/custom-fields/endpoint-get-custom-fields-html.php';
      $this->endpoint = new \Webdevia\Main_Plugin\Endpoint_Get_Custom_Fields_HTML();
      
      require_once WD_MAIN_PLUGIN_PATH . 'includes/endpoints/custom-fields/endpoint-delete-custom-field.php';
      $this->endpoint = new \Webdevia\Main_Plugin\Endpoint_Delete_Custom_Field();
    }

    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd_pricing_table.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd_client.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd_gallery.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/team.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd_portfolio.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd_testimonial.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd_countup.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd_icon_text.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd_blog.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd_progress_bars.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd_headings.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd_empty_spaces.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd-maps.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd_svg-code.php';
    include_once WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd-button.php'; 
    include_once WD_MAIN_PLUGIN_PATH . 'includes/shortcode/wd-banner.php';
    include_once WD_MAIN_PLUGIN_PATH . 'includes/shortcode/woo/product-shortcodes.php';
    include_once WD_MAIN_PLUGIN_PATH . 'includes/shortcode/wd-custom-fields.php';

    include_once WD_MAIN_PLUGIN_PATH .'meta-box.php';
    include_once WD_MAIN_PLUGIN_PATH .'woo-taxonomy-field.php';

    if( WD_MAIN_PLUGIN_THEME_SLUG == 'backhoe' ) {
      include_once( WD_MAIN_PLUGIN_PATH .'includes/shortcode/advanced-search.php' );
    } else {
      include_once( WD_MAIN_PLUGIN_PATH .'includes/shortcode/wd-advanced-search.php' );
    }
    include_once( WD_MAIN_PLUGIN_PATH .'includes/shortcode/woo_categories-creatore.php' );
    include_once( WD_MAIN_PLUGIN_PATH .'includes/shortcode/woo_categories.php' );

  }

  function admin_hooks() {
    // Update manager    
    add_filter( 'init', [ $this, 'update_manager' ] );

    add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] );

    if( wdmp_custom_field_authorized() ) {
      $panel = \Webdevia\Main_Plugin\Panel::instance();
      add_action('admin_menu', [ $panel, 'create_panel_page' ], 5 );
    }
    
		add_filter( 'devia_add_theme_options', [ $this, 'devia_add_extra_options' ] );

    add_action( 'enqueue_block_editor_assets', [ $this, 'wdmp_editor_assets' ], 100 );
  }

  function public_hooks() {
    add_filter( 'init', [ $this, 'translations_load' ] );
    add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] );

    add_action( 'init', [ $this,'enable_button_icons_block_styles'] );

    // get get a better quality image for the big image in product grid
    add_action('wp_ajax_get_feature_product_img', [ $this, 'get_feature_product_img' ] ); // executed when logged in
    add_action('wp_ajax_nopriv_get_feature_product_img', [ $this, 'get_feature_product_img' ] ); // executed when logged out
    add_filter('script_loader_tag', [ $this, 'add_module_script' ] , 10, 3);

    add_action('wp_ajax_wd_get_pagination_page', [ $this, 'wd_get_pagination_page' ]);
    add_action('wp_ajax_nopriv_wd_get_pagination_page', [ $this, 'wd_get_pagination_page' ]);

    add_action('wp_loaded', [ $this, 'wd_add_swiper_style_file']);

    if ( defined('ELEMENTOR_PATH') && ELEMENTOR_PATH ) {
      add_action( 'elementor/widgets/register', [ $this,'register_webdevia_widget'] );
    }
  }

  function enable_button_icons_block_styles() {
    wp_enqueue_block_style(
        'core/button',
        array(
            'handle' => 'enable-button-icons-block-styles',
            'src'    => WD_MAIN_PLUGIN_URI . 'build/button_style.css',
            'ver'    => wp_get_theme()->get( 'Version' ),
            'path'   => WD_MAIN_PLUGIN_URI . 'build/button_style.css',
        )
    );
}
  /**
   * Run update_manager
   */

  function update_manager(){
    require WD_MAIN_PLUGIN_PATH . 'includes/devia-update-checker.php';

    // Instantiate the deviaUpdateChecker class
    new deviaUpdateChecker(  __FILE__ , 'main' );    
  }
  
  function wd_get_pagination_page() {
    $next_page = $_POST['current_page'];
    $per_page = $_POST['per_page'];
    $query = new \WP_Query( [
      'post_type'       => 'product',
      'posts_per_page'  => $per_page,
      'paged'           => $next_page
    ] );
    if ($query->have_posts()) :
      ob_start();
      while ($query->have_posts()) : $query->the_post();
        wc_get_template_part( 'content', 'product' );
      endwhile;
      wp_reset_postdata();
      wp_send_json_success(ob_get_clean());
    else :
      wp_send_json_error('No more products!');
    endif;
  }

  public function add_module_script($tag, $handle, $src) {
    // if not your script, do nothing and return original $tag
    if ( 'wd_photo_swipe_light_box' !== $handle) {
      return $tag;
    }
    // change the script tag by adding type="module" and return it.
    $tag = '<script type="module" src="' . esc_url( $src ) . '"></script>';
    return $tag;
  }

  public function translations_load(){
    load_plugin_textdomain('wd-framework', false, dirname(plugin_basename(__FILE__)) . '/languages/');
  }

    
  function admin_enqueue_scripts( $hook_suffix ) {
    global $pagenow, $current_screen;
    $search_form_array = [];

    wp_enqueue_media(); // Enqueue the WordPress media uploader
    wp_enqueue_script( 'taxonomy_image_uploader', WD_MAIN_PLUGIN_URI . 'admin/assets/js/taxonomy-image-uploader.js', array( 'jquery' ), null, true );

    if( is_intended_post_type( 'product' ) || $pagenow == 'post.php' || str_contains( $hook_suffix, 'custom_fields' ) ) {
      
      $map_key = wdmp_get_option('google_key_map');
      wp_enqueue_script('googlemapskey', "https://maps.googleapis.com/maps/api/js?key=".$map_key."&libraries=places&v=weekly", array('jquery'), '4.4.2', true);
      wp_enqueue_script('open-layers', 'http://www.openlayers.org/api/OpenLayers.js', [], '2.0', true);

      if( wdmp_custom_field_authorized() ) {  
        wp_enqueue_script( 'admin_custom_fileds_js', WD_MAIN_PLUGIN_URI . "admin/assets/js/admin_custom_fileds.js", array('jquery', 'wp-api-request' ), '', true);
        wp_localize_script( 'admin_custom_fileds_js', 'devia', [
            'home_url'        => home_url(),
            'ajax_url'        => admin_url( 'admin-ajax.php' )
          ]
        );
        wp_enqueue_style( 'admin_custom_fileds_css', WD_MAIN_PLUGIN_URI . "admin/assets/css/style.css" );
      }
        
      $wd_search_forms = get_posts(array('post_type' => 'wd_search_form','itemperpage'   => '40'));
      foreach( $wd_search_forms as $post) {
        $search_form_array[] = [
          'label' => $post->post_title,
          'value' => $post->ID,
        ];
      }
    }

    $current_screen = get_current_screen();
    if( method_exists($current_screen, 'is_block_editor') && $current_screen->is_block_editor() ) {
      wp_enqueue_script( 'wdmp_admin_script_js', WD_MAIN_PLUGIN_URI . 'js/admin-script.js', [ ], '', true );
      wp_localize_script( 'wdmp_admin_script_js', 'devia', [
        'user_id'                 => get_current_user_id(),
        'admin_url'               => admin_url( 'admin.php' ),
        'home_url'                => home_url(),
        // 'plugin_uri'              => WD_MAIN_PLUGIN_URI,
        'ajax_url' 			          => admin_url( 'admin-ajax.php' ),
        'search_forms' 	          => $search_form_array,
        'placeholder_image_url'   => plugins_url( 'build/images/woocommerce-placeholder.5b4e5f67.png', __FILE__ )
      ] );
    }
    
    if( str_contains( $hook_suffix, 'demo-content' ) ) {
      wp_enqueue_script( 'plugin-import-script', WD_MAIN_PLUGIN_URI . '/js/import_js.js', array( 'jquery' ) );
    }

  }
  
  function wdmp_editor_assets() {
    $asset_file = include WD_MAIN_PLUGIN_PATH . 'build/editor/index.asset.php';
    
		wp_enqueue_script( 'wdmp-editor-js', WD_MAIN_PLUGIN_URI . 'build/editor/index.js', $asset_file['dependencies'], $asset_file['version'], true );
		wp_enqueue_style( 'wdmp-editor-css', WD_MAIN_PLUGIN_URI . 'build/editor/index.css', [], '1.0' );

    $asset_button = include WD_MAIN_PLUGIN_PATH . 'build/button_index.asset.php';
    wp_enqueue_script( 'wdmp-button-js', WD_MAIN_PLUGIN_URI . 'build/button_index.js', $asset_file['dependencies'], $asset_file['version'], true );
    wp_enqueue_style(
      'enable-button-icons-editor-styles',
      WD_MAIN_PLUGIN_URI . 'build/button_editor.css'
    );

    wp_enqueue_script(
      'wdmp-editor-alignment', WD_MAIN_PLUGIN_URI . '/includes/block-editor/editor.js', [ 'wp-blocks', 'wp-components', 'wp-editor', 'wp-element', 'wp-dom' ] , '', true
    );
  }

  function enqueue_scripts(){

    // wp_enqueue_style('fontawesome-file-9', get_template_directory_uri() . '/webfonts/fa-solid-900.woff2', [], null);
    // wp_enqueue_style('fontawesome-file-4', get_template_directory_uri() . '/webfonts/fa-brands-400.woff2', [], null);
    
  
    // wp_enqueue_script('select2', WD_MAIN_PLUGIN_URI ."js/select2.full.min.js", array('jquery'), [], '1.13.0', true);
    wp_register_script( 'wd_main_script', WD_MAIN_PLUGIN_URI . 'js/script.js', [ 'jquery' ], '', true );

    //wp_enqueue_script( 'wd_photo_swipe_light_box', WD_MAIN_PLUGIN_URI . 'js/PhotoSwipeLightbox.js', [ ] );

   
    wp_enqueue_script( 'wd_main_script');
    wp_localize_script( 'wd_main_script', 'devia', [
        'ajax_url'        => admin_url( 'admin-ajax.php' ),
        'home_url'        => home_url(),
        'plugin_uri'      => WD_MAIN_PLUGIN_URI,
        'date_format' 		=> get_option('date_format')
      ]
    );

		wp_enqueue_style( 'wdmp-editor-front-css', WD_MAIN_PLUGIN_URI . 'build/editor/style-index.css', [], '1.0' );

    //	wp_enqueue_style( 'select2', WD_MAIN_PLUGIN_URI . 'css/select2.min.css' );

    // Register style & script Elementor Widget
      wp_register_script( 'testimonial-widget', WD_MAIN_PLUGIN_URI . '/includes/elementor/testimonial/scripts.js' );
      wp_register_script( 'countup-widget', WD_MAIN_PLUGIN_URI . '/includes/elementor/countup/scripts.js' );
      wp_register_style( 'team-style-widget', WD_MAIN_PLUGIN_URI . '/includes/elementor/team/style.css' );
      wp_register_style( 'countup-style-widget', WD_MAIN_PLUGIN_URI . '/includes/elementor/countup/style.css' );
      wp_register_style( 'steps-style-widget', WD_MAIN_PLUGIN_URI . '/includes/elementor/steps/style.css' );
      wp_register_style( 'wd-elementor-style', WD_MAIN_PLUGIN_URI . '/includes/elementor/css/style.css' );
      wp_register_style( 'wd-elementor-woocommerce-style', WD_MAIN_PLUGIN_URI . '/includes/elementor/woocommerce/style.css' );
      wp_register_style( 'wd-elementor-recentPost-style', WD_MAIN_PLUGIN_URI . '/includes/elementor/recentPosts/style.css' );

  }

  function wd_add_swiper_style_file() {
    if( false === wp_script_is( 'swiper-js', 'enqueued' ) ){
      wp_enqueue_style('swiper-css', WD_MAIN_PLUGIN_URI . 'css/swiper-bundle.min.css');
  }
  }

  function get_feature_product_img() {    
    $post_thumbnail_url = get_the_post_thumbnail_url($_POST["ProductId"], 'full');
    wp_send_json( $post_thumbnail_url );      
  }

	public function devia_add_extra_options( $theme_options ) {
		$google_map_style = [
			'default',
			'Light',
			'Gray',
			'Dark',
			'Pale',
			'Custom'
		];

		$custom_array = '';

		$theme_options['General Settings']['fields'][] = array(
			'label'         => esc_html__( 'Map API', 'wd-framework' ),
			'id'            => 'map_api',
			'name'            => 'map_api',
			'type'          => 'dropdown',
			'defaultValue'  => [
        'google'    => 'Google',
        'ol'=> 'OpenLayers (FREE)'
      ],
			'parentSection' => "General Settings",
			"group" 				=> "Site data",
			'description'   => esc_html__( 'This option enables you to select your preferred map API provider for your website. Please note that if you choose an option other than Google Maps, some functionalities may not work properly.', 'wd-framework' ),
		);

		$theme_options['General Settings']['fields'][] = array(
			'label'         => esc_html__( 'Google Map Styles', 'wd-framework' ),
			'id'            => 'google_map_styles',
			'name'            => 'google_map_styles',
			'type'          => 'dropdown',
			'defaultValue'  => $google_map_style,
			'parentSection' => "General Settings",
			"group" 				=> "Site data",
			'description'   => esc_html__( 'These are the available styles for all maps in your site', 'wd-framework' ),
		);

		$theme_options['General Settings']['fields'][] = array(
			'label'         => esc_html__( 'Google Map Custom Styles', 'wd-framework' ),
			'id'            => 'google_map_custom_style',
			'name'            => 'google_map_custom_style',
			'type'          => 'textarea',
			'defaultValue'  => $custom_array,
			'parentSection' => "General Settings",
			"group" 				=> "Site data",
			'description'   => esc_html__( 'Here you can paste the javascript array for your custom map style (the array needs to be valid or an error will be thrown!). Make sure that you have selected the custom style option first. Choose or customize a map from the following website: https://snazzymaps.com', 'wd-framework' ),
		);

		$theme_options['General Settings']['fields'][] = array(
			'label'         => esc_html__( 'Map has areas', 'wd-framework' ),
			'id'            => 'google_map_areas',
			'name'            => 'google_map_areas',
			'type'          => 'checkbox',
			'defaultValue'  => 'off',
			'parentSection' => "General Settings",
			"group" 				=> "Site data",
			'description'   => esc_html__( 'The Area option provides users with the ability to indicate a general area surrounding their location instead of sharing the exact address. This option allows users to maintain privacy while still providing a visual representation of their approximate location on the map.', 'wd-framework' ),
		);

		$theme_options['General Settings']['fields'][] = array(
			'label'         => esc_html__( 'Map Areas Width', 'wd-framework' ),
			'id'            => 'google_map_area_width',
			'name'            => 'google_map_area_width',
			'type'          => 'text',
			'defaultValue'  => 4000,
			'parentSection' => "General Settings",
			"group" 				=> "Site data",
			'description'   => esc_html__( 'This option determines the visual representation of the circle\'s size on the map. Please specify the desired width of the area circles by entering a number.', 'wd-framework' ),
		);

		return $theme_options;
	}

  /**
   * Register webdevia Widget.
   *
   * Include widget file and register widget class.
   *
   * @since 1.0.0
   * @param \Elementor\Widgets_Manager $widgets_manager Elementor widgets manager.
   * @return void
   */
  function register_webdevia_widget( $widgets_manager ) {
    wp_enqueue_style('wd-elementor-style');
    require_once( WD_MAIN_PLUGIN_PATH . 'includes/elementor/testimonial/testimonial-widget.php' );
    require_once( WD_MAIN_PLUGIN_PATH . 'includes/elementor/team/team-widget.php' );
    require_once( WD_MAIN_PLUGIN_PATH . 'includes/elementor/countup/countup-widget.php' );
    require_once( WD_MAIN_PLUGIN_PATH . 'includes/elementor/portfolio/portfolio-widget.php' );
    require_once( WD_MAIN_PLUGIN_PATH . 'includes/elementor/steps/steps-widget.php' );
    require_once( WD_MAIN_PLUGIN_PATH . 'includes/elementor/woocommerce/products-widget.php' );
    require_once( WD_MAIN_PLUGIN_PATH . 'includes/elementor/recentPosts/recentPosts-widget.php' );

    $widgets_manager->register( new \wd_testimonial_Widget() );
    $widgets_manager->register( new \wd_team_Widget() );
    $widgets_manager->register( new \wd_countup_Widget() );
    $widgets_manager->register( new \wd_portfolio_Widget() );
    $widgets_manager->register( new \wd_steps_Widget() );
    $widgets_manager->register( new \wd_WooCommerce_Widget() );
    $widgets_manager->register( new \wd_recentPosts_Widget() );

  }

}

WebdeviaFramework::instance();

// add link to awesome font in header to speed up loading
add_filter('style_loader_tag', 'wdmp_style_loader_tag_filter', 10, 2);
function wdmp_style_loader_tag_filter($html, $handle) {
    
    if ($handle === 'fontawesome-file-9' || $handle === 'fontawesome-file-4') {
        return str_replace("rel='stylesheet'",
            "rel='preload' as='font' crossorigin='anonymous'", $html);
    }
    return $html;
}

// add action function to speed up loading google fonts
function wdmp_prefetch() {
        echo '<link rel="preconnect" href="https://fonts.gstatic.com">';
}
add_action('wp_head', 'wdmp_prefetch', 5);

  add_action( 'wp_ajax_wdgetproduct', 'wdmp_get_products_ajax_callback' ); // wp_ajax_{action}

  add_action('wp_ajax_nopriv_wdgetproduct', 'wdmp_get_products_ajax_callback');

  function wdmp_get_products_ajax_callback(){

    // we will pass post IDs and titles to this array
    $return = array();
    // you can use WP_Query, query_posts() or get_posts() here - it doesn't matter
      $cat ="";
      if($_GET['term'] != -1) {
          $cat = $_GET['term'];
      }
    $search_results = new \WP_Query( array(
      'post_type'             => 'product',
      'post_status'           => 'publish',
      's'=> $_GET['q'], // the search query
      'ignore_sticky_posts' => 1,
      'category_name' => $cat,
      'posts_per_page' => 50 // how much to show at once
    ) );
    
    if( $search_results->have_posts() ) :
      while( $search_results->have_posts() ) : $search_results->the_post();
        // shorten the title a little
        $title = ( mb_strlen( $search_results->post->post_title ) > 50 ) ? mb_substr( $search_results->post->post_title, 0, 49 ) . '...' : $search_results->post->post_title;
        $return[] = array( $search_results->post->ID, $title, get_the_post_thumbnail_url( $search_results->post->ID, 'full' ),get_post_permalink($search_results->post->ID) ); // array( Post ID, Post Title )
      endwhile;
    endif;
    echo json_encode( $return );
    die;
  }


add_filter( 'allowed_http_origins', 'add_allowed_origins' );
function add_allowed_origins( $origins ) {
    $origins[] = 'https://bidpro.webdevia.com/';
    $origins[] = 'https://themes.webdevia.com/bidpro-marketplace-auctions-wooCommerce-theme/';
    return $origins;
}