__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php
namespace EssentialBlocks\Integrations;

use EssentialBlocks\Utils\Helper;
use EssentialBlocks\Utils\HttpRequest;

class NFT extends ThirdPartyIntegration {
    /**
     * Base URL for Openverse API
     *
     * @var string
     */
    const URL = 'https://api.opensea.io/api/';

    public function __construct() {
        $this->add_ajax(
            [
                'opensea_nft_collections' => [
                    'callback' => 'collections',
                    'public'   => true
                ],
                'opensea_api_key'         => [
                    'callback' => 'get_api',
                    'public'   => true
                ],
                'opensea_api_key_save'    => [
                    'callback' => 'save_api',
                    'public'   => false
                ]
            ]
        );
    }

    /**
     * API Call to Get NFT Data
     */
    public function collections() {
        if ( ! wp_verify_nonce( sanitize_key( $_POST['nft_nonce'] ), 'eb-nft-nonce' ) ) {
            die( esc_html__( 'Nonce did not match', 'essential-blocks' ) );
        }

        $limit = 6;

        if ( isset( $_POST['nft_source'] ) && sanitize_text_field( $_POST['nft_source'] ) === 'opensea' ) {
            $opensea_api = '';
            $settings    = get_option( 'eb_settings' );

            if ( isset( $_POST['openseaApiKey'] ) ) {
                $opensea_api = sanitize_text_field( $_POST['openseaApiKey'] );
            } elseif ( is_array( $settings ) && isset( $settings['openseaApi'] ) ) {
                $opensea_api = sanitize_text_field( $settings['openseaApi'] );
            }

            $param = [];

            if ( isset( $_POST['openseaType'] ) ) {
                // To retrieve Collections
                if ( $_POST['openseaType'] === 'collections' ) {
                    $url    = $this->url( 'collections', 'v2/' );
                    $values = [
                        'creator_username' => Helper::is_isset( 'openseaCollectionmWalletId' ),
                        'offset'      => Helper::is_isset( 'offset', 0 ),
                        'limit'       => Helper::is_isset( 'openseaCollectionLimit', $limit )
                    ];
                    $param = array_merge( $param, $values );
                }
                // To retrieve Assets
                elseif ( $_POST['openseaType'] === 'items' ) {
                    $collection_slug = Helper::is_isset( 'openseaCollectionSlug' );
                    $url    = $this->url( 'collection/'.$collection_slug.'/nfts', 'v2/' );
                    $values = [
                        'limit' => Helper::is_isset( 'openseaItemLimit', $limit ),
                    ];

                    $param = array_merge( $param, $values );
                }
            }

            $response = HttpRequest::get_instance()->get(
                $url,
                [
                    'body'    => $param,
                    'headers' => [
                        'Content-Type' => 'application/json',
                        'X-API-KEY'    => $opensea_api
                    ],
                    'timeout' => 300,
                    'is_ajax' => true
                ]
            );

            wp_send_json_success( $response );
        }

        wp_send_json_error( __( 'Something went wrong.', 'essential-blocks' ) );
    }

    /**
     * Get OpenSea API Key
     * Only admins get real API key, editors get dummy data for preview
     */
    public function get_api() {
        if ( ! wp_verify_nonce( $_POST['admin_nonce'], 'admin-nonce' ) ) {
            die( esc_html__( 'Nonce did not match', 'essential-blocks' ) );
        }

        // Check if user has at least edit_posts capability
        if ( ! current_user_can( 'edit_posts' ) ) {
            wp_send_json_error( __( 'You are not authorized!', 'essential-blocks' ) );
        }

        // Only admins get the real API key
        if ( current_user_can( 'manage_options' ) ) {
            $settings = get_option( 'eb_settings' );

            if ( is_array( $settings ) && isset( $settings['openseaApi'] ) ) {
                wp_send_json_success( $settings['openseaApi'] );
            } else {
                wp_send_json_error( "Couldn't found data" );
            }
        } else {
            // Non-admin users with edit_posts capability get dummy API key for editor preview
            wp_send_json_success( 'dummy_opensea_api_key_for_editor_preview' );
        }
    }
    public function save_api() {
        if ( ! wp_verify_nonce( $_POST['admin_nonce'], 'admin-nonce' ) ) {
            die( esc_html__( 'Nonce did not match', 'essential-blocks' ) );
        }
        if ( ! current_user_can( 'activate_plugins' ) ) {
            wp_send_json_error( __( 'You are not authorized!', 'essential-blocks' ) );
        }

        $api = '';
        if ( isset( $_POST['openseaApi'] ) ) {
            $api = trim( sanitize_text_field( $_POST['openseaApi'] ) );
        }

        $settings = is_array( get_option( 'eb_settings' ) ) ? get_option( 'eb_settings' ) : [];
        if ( strlen( $api ) === 0 ) {
            unset( $settings['openseaApi'] );
        } else {
            $settings['openseaApi'] = $api;
        }

        if ( is_array( $settings ) > 0 ) {
            $output = update_option( 'eb_settings', $settings );
            wp_send_json_success( $output );
        } else {
            wp_send_json_error( "Couldn't save data" );
        }

        exit;
    }
}

Filemanager

Name Type Size Permission Actions
AI Folder 0750
AssetGeneration.php File 2.19 KB 0640
BlockUsage.php File 2.79 KB 0640
Data.php File 2.4 KB 0640
Form.php File 23.62 KB 0640
GlobalStyles.php File 5.46 KB 0640
GoogleMap.php File 4.28 KB 0640
Instagram.php File 1.29 KB 0640
NFT.php File 5.37 KB 0640
OpenVerse.php File 10.3 KB 0640
Pagination.php File 3.48 KB 0640
PluginInstaller.php File 2.62 KB 0640
TemplatelyPatterns.php File 4.22 KB 0640
ThirdPartyIntegration.php File 1.2 KB 0640
Filemanager