| Server IP : 89.108.64.180 / Your IP : 216.73.217.92 Web Server : Apache/2.4.41 (Ubuntu) System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-root ( 1010) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,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, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/hostelfortuna.ru/wp-content/plugins/easy-fancybox/src/ |
Upload File : |
import { InspectorControls } from '@wordpress/block-editor';
import { PanelBody, Button, ToggleControl } from '@wordpress/components';
import { createHigherOrderComponent } from '@wordpress/compose';
import { addFilter } from '@wordpress/hooks';
import { __ } from '@wordpress/i18n';
import './blocks.scss';
const withLightboxPanelControls = createHigherOrderComponent( ( BlockEdit ) => {
return ( props ) => {
const { name } = props;
const isImageOrGalleryBlock = 'core/image' === name || 'core/gallery' === name;
// firelight object passed via wp_localize_script
const activeLightbox = firelight.activeLightbox;
const isProLightbox = 'Firelight Pro Lightbox' === activeLightbox;
const isPayingUser = firelight.isPayingUser;
const isProUser = firelight.isProUser;
const settingsUrl = firelight.settingsUrl;
const lightboxPanelOpen = firelight.lightboxPanelOpen === '1' ? true : false;
if ( ! isImageOrGalleryBlock ) {
return <BlockEdit { ...props } />
}
return (
<>
<BlockEdit key="edit" { ...props } />
<InspectorControls>
<PanelBody className='fancybox-settings' title={ __( 'Lightbox' ) } initialOpen={ lightboxPanelOpen }>
<p>
{ __( 'You are using: ' ) }
<span className='fancybox-active-lightbox'>{ activeLightbox }</span>
{ '.' }
</p>
{
! isProUser && (
<>
<ToggleControl
label="Use Pro Lightbox?"
checked={ false }
disabled
/>
<p className="fancybox-upgrade-notice">
{ __( 'Upgrade to enable Pro Lightbox.' ) }<br/>
<strong>{ __( ' 20% off with coupon PRO20.' ) }</strong>
</p>
<div className="fancybox-button-container">
<Button
variant="primary"
className="fancybox-button"
href='https://firelightwp.com/pro-lightbox/?utm_source=block-editor&utm_medium=referral&utm_campaign=easy-fancybox'
target='_blank'
>
{ __( 'Demos' ) }
</Button>
{ ' ' }
<Button
variant="primary"
className="fancybox-button"
href='https://firelightwp.com/pro-lightbox/pricing/?utm_source=block-editor&utm_medium=referral&utm_campaign=easy-fancybox'
target='_blank'
>
{ isPayingUser ? __( 'Upgrade' ) : __( 'Try It Free' ) }
</Button>
</div>
</>
)
}
{
isProUser && ! isProLightbox && (
<p>{ __( 'Notice: You have an active Firelight Pro license and can use the Firelight Pro Lightbox!') }</p>
)
}
<div className="fancybox-settings-link">
<Button
variant="link"
href={ settingsUrl }
target='_blank'
>
{ __( 'View Lightbox Settings' ) }
</Button>
</div>
</PanelBody>
</InspectorControls>
</>
);
};
}, 'withLightboxPanelControls' );
addFilter(
'editor.BlockEdit',
'lightpress/lightbox-panel',
withLightboxPanelControls
);