403Webshell
Server IP : 213.186.33.4  /  Your IP : 216.73.216.222
Web Server : Apache
System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64
User : karinebmkh ( 644538)
PHP Version : 8.4.22
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/karinebmkh/www/wp-content/plugins/spotlight-social-photo-feeds/modules/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/karinebmkh/www/wp-content/plugins/spotlight-social-photo-feeds/modules//WpBlockModule.php
<?php

namespace RebelCode\Spotlight\Instagram\Modules;

use Dhii\Services\Factories\Constructor;
use Dhii\Services\Factories\Value;
use Dhii\Services\Factory;
use Psr\Container\ContainerInterface;
use RebelCode\Spotlight\Instagram\Di\ArrayExtension;
use RebelCode\Spotlight\Instagram\Module;
use RebelCode\Spotlight\Instagram\Wp\Asset;
use WP_Block_Type;

/**
 * The module that adds the Spotlight block type to the WordPress block editor.
 *
 * @since 0.3
 */
class WpBlockModule extends Module
{
    /**
     * @inheritDoc
     *
     * @since 0.3
     */
    public function run(ContainerInterface $c): void
    {
        add_action('enqueue_block_editor_assets', function () use ($c) {
            // Register block assets
            Asset::register('sli-wp-block-js', $c->get('editor_script'));
            Asset::register('sli-wp-block-css', $c->get('editor_style'));

            // Makes sure script config is localized
            do_action('spotlight/instagram/localize_config');

            // Triggers action to allow extension
            do_action('spotlight/wp_block/register_assets');
        });
    }

    /**
     * @inheritDoc
     *
     * @since 0.3
     */
    public function getFactories(): array
    {
        return [
            'type' => new Constructor(WP_Block_Type::class, ['id', 'args']),
            'id' => new Value('spotlight/instagram'),
            'args' => new Factory(['render_fn'], function ($renderFn) {
                return [
                    'editor_script' => 'sli-wp-block-js',
                    'editor_style' => 'sli-wp-block-css',
                    'render_callback' => $renderFn,
                ];
            }),
            'editor_script' => new Factory(
                ['@ui/scripts_url', '@ui/assets_ver', 'script_deps'],
                function ($url, $ver, $deps) {
                    return Asset::script("{$url}/wp-block.js", $ver, $deps);
                }
            ),
            'editor_style' => new Factory(
                ['@ui/scripts_url', '@ui/assets_ver', 'style_deps'],
                function ($url, $ver, $deps) {
                    return Asset::style("{$url}/styles/wp-block.css", $ver, $deps);
                }
            ),
            'script_deps' => new Value([
                'sli-admin-common',
                'sli-editor',
            ]),
            'style_deps' => new Value([
                'sli-admin-common',
                'sli-editor',
            ]),
            'render_fn' => new Factory(['@shortcode/callback'], function ($shortcode) {
                return function ($attrs) use ($shortcode) {
                    $feedId = $attrs['feedId'] ?? 0;
                    $className = $attrs['className'] ?? '';

                    return (is_numeric($feedId) && $feedId > 0)
                        ? call_user_func($shortcode, ['feed' => $feedId, 'class-name' => $className])
                        : '';
                };
            }),
        ];
    }

    /**
     * @inheritDoc
     *
     * @since 0.3
     */
    public function getExtensions(): array
    {
        return [
            // Register the block type to WordPress
            'wp/block_types' => new ArrayExtension(['type']),
        ];
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit