wppb_get_users_pagination_slug())); wp_enqueue_style('wppb-ul-slider-css', WPPB_PAID_PLUGIN_URL . 'add-ons/user-listing/jquery-ui-slider.min.css', array(), PROFILE_BUILDER_VERSION); wp_enqueue_script('jquery-ui-slider'); } } } ); add_action( 'enqueue_block_editor_assets', function () { global $content_restriction_activated; global $wp_version; global $pagenow; $arrDeps = ($pagenow === 'widgets.php') ? array( 'wp-blocks', 'wp-dom', 'wp-dom-ready', 'wp-edit-widgets' ) : array( 'wp-blocks', 'wp-dom', 'wp-dom-ready', 'wp-edit-post' ); //Register the Block Content Restriction assets if ( $content_restriction_activated == 'yes' && version_compare( $wp_version, "5.0.0", ">=" ) ) { wp_register_script( 'wppb-block-editor-assets-content-restriction', WPPB_PLUGIN_URL . 'assets/misc/gutenberg/block-content-restriction/build/index.js', $arrDeps, PROFILE_BUILDER_VERSION ); wp_enqueue_script('wppb-block-editor-assets-content-restriction'); if (!function_exists('get_editable_roles')) { require_once ABSPATH . 'wp-admin/includes/user.php'; } $user_roles_initial = get_editable_roles(); foreach ($user_roles_initial as $key => $role) { $user_roles[] = [ "slug" => $key, "name" => $role['name'], ]; } $vars_array = array( 'userRoles' => json_encode($user_roles), 'content_restriction_activated' => json_encode($content_restriction_activated == 'yes'), ); wp_localize_script('wppb-block-editor-assets-content-restriction', 'wppbBlockEditorData', $vars_array); } // Disable pointer events for our forms inside the Editing interface $style = '.wppb-block-container{ pointer-events: none; }'; wp_add_inline_style( 'wp-block-library', $style ); } ); add_action( 'init', function () { global $content_restriction_activated; global $wp_version; //Register the Content Restriction Start and Content Restriction End blocks if ( $content_restriction_activated == 'yes' && version_compare( $wp_version, "5.0.0", ">=" ) ) { if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/blocks/build/content-restriction-start' ) ) register_block_type( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/blocks/build/content-restriction-start' ); if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/blocks/build/content-restriction-end' ) ) register_block_type( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/blocks/build/content-restriction-end' ); } //Register the shortcode blocks if ( version_compare( $wp_version, "5.0.0", ">=" ) ) { if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/blocks/edit-profile.php' ) ) include_once WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/blocks/edit-profile.php' ; if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/blocks/login.php' ) ) include_once WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/blocks/login.php' ; if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/blocks/recover-password.php' ) ) include_once WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/blocks/recover-password.php' ; if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/blocks/register.php' ) ) include_once WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/blocks/register.php' ; if( defined( 'WPPB_PAID_PLUGIN_URL' ) && wppb_check_if_add_on_is_active( 'wppb_userListing' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/user-listing/assets/misc/gutenberg/blocks/user-listing.php' ) ) include_once( WPPB_PAID_PLUGIN_DIR . '/add-ons/user-listing/assets/misc/gutenberg/blocks/user-listing.php' ); } } ); function register_layout_category( $categories ) { $categories[] = array( 'slug' => 'wppb-block', 'title' => 'Profile Builder' ); return $categories; } if ( version_compare( get_bloginfo( 'version' ), '5.8', '>=' ) ) { add_filter( 'block_categories_all', 'register_layout_category' ); } else { add_filter( 'block_categories', 'register_layout_category' ); }