| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.9/wp-content/themes/blocksy/inc/components/blocks/ |
Upload File : |
<?php
namespace Blocksy;
class BlocksFallback {
public function __construct() {
add_filter(
'render_block',
[$this, 'render_block'],
10,
3
);
}
public function render_block($content, $block, $render) {
if (! isset($block['blockName'])) {
return $content;
}
if (strpos($block['blockName'], 'blocksy/') !== 0) {
return $content;
}
$blockRegistry = \WP_Block_Type_Registry::get_instance();
if ($blockRegistry->is_registered($block['blockName'])) {
return $content;
}
if (! current_user_can('manage_options')) {
return '';
}
$block_names_map = [
'blocksy/about-me' => __('About Me', 'blocksy'),
'blocksy/breadcrumbs' => __('Breadcrumbs', 'blocksy'),
'blocksy/contact-info' => __('Contact Info', 'blocksy'),
'blocksy/query' => __('Advanced Posts', 'blocksy'),
'blocksy/search' => __('Advanced Search', 'blocksy'),
'blocksy/share-box' => __('Share Box', 'blocksy'),
'blocksy/socials' => __('Socials', 'blocksy'),
'blocksy/dynamic-data' => __('Dynamic Data', 'blocksy'),
];
$block_name = $block['blockName'];
if ($block_name === 'blocksy/widgets-wrapper') {
if (
isset($block['attrs'])
&&
isset($block['attrs']['block'])
) {
$block_name = $block['attrs']['block'];
} else {
foreach ($block['innerBlocks'] as $inner_block) {
if (
isset($inner_block['blockName'])
&&
strpos($inner_block['blockName'], 'blocksy/') === 0
) {
$block_name = $inner_block['blockName'];
break;
}
}
}
}
if (! isset($block_names_map[$block_name])) {
return $content;
}
return blocksy_html_tag(
'div',
[],
sprintf(
__('The %s block is moved to the Blocksy Companion plugin. Please install this plugin to get access to the block.', 'blocksy'),
$block_names_map[$block_name]
)
);
}
}