# profile-builder/3.9.8/assets/misc/elementor/class-elementor.php

User Profile Builder – Beautiful User Registration Forms, User Profiles &amp; User Role Editor, version 3.9.8. 91 lines.

- Page: https://pluginprobe.com/plugins/profile-builder/3.9.8/code/assets/misc/elementor/class-elementor.php
- Raw: https://pluginprobe.com/plugins/profile-builder/3.9.8/raw/assets/misc/elementor/class-elementor.php
- Modified: 2023-03-20T06:43:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/profile-builder/3.9.8/code/assets/misc/elementor/class-elementor.php#L10-L20`.

```php
<?php

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;

use Elementor\Controls_Manager;

class PB_Elementor {
    private static $_instance = null;
    public $locations = array(
        array(
            'element' => 'common',
            'action'  => '_section_style',
        ),
        array(
            'element' => 'section',
            'action'  => 'section_advanced',
        )
    );
    public $section_name = 'pb_section_visibility_settings';

	/**
	 * Register plugin action hooks and filters
	 */
	public function __construct() {
        // Add category
        add_action( 'elementor/elements/categories_registered', array( $this, 'add_category' ) );

		// Register widgets
		add_action( 'elementor/widgets/widgets_registered', array( $this, 'register_widgets' ) );
	}

    /**
     *
     * Ensures only one instance of the class is loaded or can be loaded.
     *
     * @return PB_Elementor An instance of the class.
     */
    public static function instance() {
        if ( is_null( self::$_instance ) )
            self::$_instance = new self();

        return self::$_instance;
    }

	/**
	 * Include Widgets files
	 */
	private function include_widgets_files() {
		require_once(__DIR__ . '/widgets/class-pb-widget-epf.php');
		require_once(__DIR__ . '/widgets/class-pb-widget-l.php');
		require_once(__DIR__ . '/widgets/class-pb-widget-rp.php');
		require_once(__DIR__ . '/widgets/class-pb-widget-rf.php');
		require_once(__DIR__ . '/widgets/class-pb-widget-ul.php');
	}

	/**
	 * Register Widgets
	 */
	public function register_widgets() {
		$this->include_widgets_files();

        if( version_compare( ELEMENTOR_VERSION, '3.5,', '>=' ) ){
            \Elementor\Plugin::instance()->widgets_manager->register( new PB_Elementor_Edit_Profile_Widget() );
            \Elementor\Plugin::instance()->widgets_manager->register( new PB_Elementor_Login_Widget() );
            \Elementor\Plugin::instance()->widgets_manager->register( new PB_Elementor_Recover_Password_Widget() );
            \Elementor\Plugin::instance()->widgets_manager->register( new PB_Elementor_Register_Widget() );
            \Elementor\Plugin::instance()->widgets_manager->register( new PB_Elementor_User_Listing_Widget() );
        } else {
            \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new PB_Elementor_Edit_Profile_Widget() );
            \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new PB_Elementor_Login_Widget() );
            \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new PB_Elementor_Recover_Password_Widget() );
            \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new PB_Elementor_Register_Widget() );
            \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new PB_Elementor_User_Listing_Widget() );
        }
	}

    public function add_category( $elements_manager ) {
        $elements_manager->add_category(
            'profile-builder',
            array(
                'title' => __( 'Profile Builder Forms', 'profile-builder' ),
                'icon'  => 'fa fa-plug',
            )
        );
    }
}

// Instantiate Plugin Class
PB_Elementor::instance();

```
