WS_OK_7.4.33 HEX
HEX
Server: nginx/1.21.4
System: Linux v12674 6.8.0-85-generic #85-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 18 15:26:59 UTC 2025 x86_64
User: endtheignorance (1014)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v12674/lcalexington/public_html/wp-content/plugins/wp-hummingbird/_src/js/block.js
import Fetcher from './utils/fetcher';

const { PluginPostStatusInfo } = wp.editPost;
const { registerPlugin } = wp.plugins;
const { select, dispatch } = wp.data;

/**
 * Handle clear cache action.
 */
const handleClearCache = () => {
    const postId = select( 'core/editor' ).getCurrentPostId();
    Fetcher.caching.clearCacheForPost(postId).then( showNotice );
};

/**
 * Show notice.
 */
const showNotice = () => {
    const notices = select( 'core/notices' ).getNotices();
    if ( ! notices.find( notice => notice.id === 'wphb-gb-notice' ) ) {
        dispatch( 'core/notices' ).createNotice( 'success', wphb.strings.notice, { id: 'wphb-gb-notice' } );
    }
};

/**
 * Add clear cache button.
 *
 * @returns {*}
 * @constructor
 */
const MyPluginPostStatusInfo = () => (
    <PluginPostStatusInfo className="wphb-clear-cache">
        <input type="submit" value={ wphb.strings.button } onClick={ handleClearCache }
               className="components-button is-button is-default is-large editor-post-trash" />
    </PluginPostStatusInfo>
);

registerPlugin( 'wphb', { render: MyPluginPostStatusInfo } );