GRAYBYTE WORDPRESS FILE MANAGER4882

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/giriqfky/trustyourlawyer.com/wp-content/plugins/essential-blocks/includes/Core/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/giriqfky/trustyourlawyer.com/wp-content/plugins/essential-blocks/includes/Core//Blocks.php
<?php

namespace EssentialBlocks\Core;

use EssentialBlocks\Utils\Settings;
use EssentialBlocks\Traits\HasSingletone;

class Blocks
{
    use HasSingletone;

    private $enabled_blocks = [];
    private $settings       = null;
    private $dir            = '';

    public function __construct($settings)
    {
        $this->settings       = $settings;
        // $this->enabled_blocks = $this->enabled();

        $this->dir = ESSENTIAL_BLOCKS_BLOCK_DIR;
    }

    public function is_enabled($key = null)
    {
        if (empty($key)) {
            return true;
        }

        return isset($this->enabled_blocks[$key]);
    }

    public static function all()
    {
        $all_blocks = Settings::get('essential_all_blocks', []);
        $_defaults  = self::defaults();

        if (empty($all_blocks)) {
            return $_defaults;
        }

        return array_replace_recursive($_defaults, $all_blocks);
    }

    public function enabled()
    {
        $blocks         = $this->all();
        $enabled_blocks = array_filter(
            $blocks,
            function ($a) {
                return isset($a['visibility']) && $a['visibility'] === 'true' ? $a : false;
            }
        );

        $this->enabled_blocks = $enabled_blocks;

        return $enabled_blocks;
    }

    public static function defaults($no_object = true, $no_static_data = true)
    {
        $_blocks = require ESSENTIAL_BLOCKS_DIR_PATH . 'includes/blocks.php';
        $_blocks = apply_filters('essential_blocks_block_lists', $_blocks);
        $_blocks = array_map(
            function ($block) use ($no_object, $no_static_data) {
                if ($no_object) {
                    unset($block['object']);
                }
                if ($no_static_data) {
                    unset($block['demo']);
                    unset($block['doc']);
                    unset($block['icon']);
                    unset($block['status']);
                }

                return $block;
            },
            $_blocks
        );

        return $_blocks;
    }

    public function register_blocks($assets_manager)
    {
        $blocks = $this->enabled();
        if (empty($blocks)) {
            return;
        }

        $_defaults = $this->defaults(false);

        foreach ($blocks as $block_name => $block) {
            if (isset($_defaults[$block_name]['object'])) {
                $block_object = $_defaults[$block_name]['object'];

                if (! $block_object->can_enable()) {
                    continue;
                }

                if (method_exists($block_object, 'load_dependencies')) {
                    $block_object->load_dependencies();
                }

                if (method_exists($block_object, 'inner_blocks')) {
                    $_inner_blocks = $block_object->inner_blocks();
                    foreach ($_inner_blocks as $block_name => $block) {
                        if (method_exists($block, 'load_dependencies')) {
                            $block->load_dependencies();
                        }

                        $block->register($assets_manager);
                    }
                }

                $block_object->register($assets_manager);
            }
        }

        // Only apply special handling for pro blocks when pro plugin is not active
        if (!defined('ESSENTIAL_BLOCKS_IS_PRO_ACTIVE') || !ESSENTIAL_BLOCKS_IS_PRO_ACTIVE) {
            // These blocks will be filtered out in the frontend by the render_block filter
            foreach($_defaults as $block) {
                if (isset($block['is_pro']) && $block['is_pro'] && isset($block['name'])) {
                    register_block_type("essential-blocks/" . $block['name'], [
                        'render_callback' => function($attributes, $content) {
                            // Return empty content in frontend when pro plugin is not active
                            if (!is_admin() && !(defined('REST_REQUEST') && REST_REQUEST)) {
                                return '';
                            }
                            return $content;
                        }
                    ]);
                }
            }
        }
    }

    public static function quick_toolbar_blocks()
    {
        $all_blocks = Settings::get('eb_quick_toolbar_allowed_blocks', []);

        $_defaults  = array(
            'essential-blocks/wrapper',
            'essential-blocks/text',
            'essential-blocks/advanced-heading',
            'essential-blocks/infobox',
            'essential-blocks/button',
            'essential-blocks/advanced-image',
            'essential-blocks/feature-list'
        );

        if (empty($all_blocks)) {
            return $_defaults;
        }

        return $all_blocks;
    }
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 10 2025 04:32:25
giriqfky / giriqfky
0755
.htaccess
0.41 KB
July 10 2025 04:32:25
giriqfky / giriqfky
0644
Block.php
5.437 KB
June 01 2025 14:07:44
giriqfky / giriqfky
0644
Blocks.php
4.693 KB
June 01 2025 14:07:44
giriqfky / giriqfky
0644
BlocksPatterns.php
5.336 KB
February 18 2025 14:31:10
giriqfky / giriqfky
0644
FaqSchema.php
6.876 KB
January 12 2025 17:13:54
giriqfky / giriqfky
0644
FontLoader.php
4.785 KB
June 05 2024 11:39:46
giriqfky / giriqfky
0644
Maintenance.php
4.424 KB
May 08 2025 15:01:12
giriqfky / giriqfky
0644
ModifyWPCore.php
0.743 KB
August 09 2023 14:57:00
giriqfky / giriqfky
0644
PageTemplates.php
4.865 KB
December 24 2024 15:38:54
giriqfky / giriqfky
0644
PostMeta.php
0.622 KB
August 09 2023 14:57:00
giriqfky / giriqfky
0644
Scripts.php
29.242 KB
June 20 2025 18:31:30
giriqfky / giriqfky
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF