Server IP : 172.67.216.182 / Your IP : 162.158.170.35 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 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 MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/wwwroot/savinassociates.com/wp-content/plugins/redux-framework/extendify-sdk/src/ |
Upload File : |
import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post' import { render } from '@wordpress/element' import { __ } from '@wordpress/i18n' import { Icon } from '@wordpress/icons' import { registerPlugin } from '@wordpress/plugins' import LibraryAccessModal from '@extendify/components/LibraryAccessModal' import { CtaButton, MainButtonWrapper } from '@extendify/components/MainButtons' import { brandMark } from '@extendify/components/icons/' const userState = window.extendifyData?.user?.state const isAdmin = () => window.extendifyData.user === null || userState?.isAdmin const isGlobalLibraryEnabled = () => window.extendifyData.sitesettings === null || window.extendifyData?.sitesettings?.state?.enabled const isLibraryEnabled = () => window.extendifyData.user === null ? isGlobalLibraryEnabled() : userState?.enabled // Add the MAIN button when Gutenberg is available and ready const finish = window?.wp?.data?.subscribe(() => { requestAnimationFrame(() => { if (!isGlobalLibraryEnabled() && !isAdmin()) { return } if (document.getElementById('extendify-templates-inserter')) { return } if ( !document.querySelector('.edit-post-header-toolbar') && !document.querySelector('.edit-site-header_start') // FSE ) { return } const buttonContainer = Object.assign(document.createElement('div'), { id: 'extendify-templates-inserter', }) // Standard block editor document .querySelector('.edit-post-header-toolbar') ?.append(buttonContainer) // FSE block editor document .querySelector('.edit-site-header_start') ?.append(buttonContainer) render(<MainButtonWrapper />, buttonContainer) if (!isLibraryEnabled()) { document .getElementById('extendify-templates-inserter-btn') .classList.add('hidden') } finish() }) }) // The CTA button inside patterns const finish2 = window?.wp?.data?.subscribe(() => { requestAnimationFrame(() => { if (!isGlobalLibraryEnabled() && !isAdmin()) { return } if (!document.querySelector('[id$=patterns-view]')) { return } if (document.getElementById('extendify-cta-button')) { return } const ctaButtonContainer = Object.assign( document.createElement('div'), { id: 'extendify-cta-button-container' }, ) document .querySelector('[id$=patterns-view]') .prepend(ctaButtonContainer) render(<CtaButton />, ctaButtonContainer) finish2() }) }) // This will add a button to enable or disable the library button const LibraryEnableDisable = () => { function setOpenSiteSettingsModal() { const util = document.getElementById('extendify-util') render(<LibraryAccessModal />, util) } return ( <> <PluginSidebarMoreMenuItem onClick={setOpenSiteSettingsModal} icon={<Icon icon={brandMark} size={24} />}> {' '} {__('Extendify', 'extendify')} </PluginSidebarMoreMenuItem> </> ) } // Load this button always, which is used to enable or disable // FSE doesn't seem to recognize registerPlugin (yet) try { registerPlugin('extendify-settings-enable-disable', { render: LibraryEnableDisable, }) } catch (e) { console.error( 'registerPlugin not supported? (error handled gracefully)', e.message, ) }