since the sidebar persists across every admin screen.
*/
function highlightHelpDemoMenu() { ?>
BIGB_PLUGIN_VERSION,
'isPremium' => false,
'hasPro' => false,
'adminUrl' => admin_url(),
'nonce' => wp_create_nonce('igb_activation_nonce'),
'licenseActiveNonce' => wp_create_nonce( 'igb_activation_nonce' ),
'uninstallNonce' => wp_create_nonce('igb_activation_nonce'),
'deleteDataOnUninstall' => (bool) get_option( 'igb_delete_data_on_uninstall', false ),
] ) ); ?>'
>
__( 'Invalid security token.', 'image-gallery' ) ] );
}
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( [ 'message' => __( 'You do not have permission to perform this action.', 'image-gallery' ) ] );
}
$enabled = isset( $_POST['enabled'] ) && ( 'true' === $_POST['enabled'] || true === $_POST['enabled'] || 1 == $_POST['enabled'] );
update_option( 'igb_delete_data_on_uninstall', $enabled );
wp_send_json_success( [
'enabled' => $enabled,
'message' => __( 'Setting saved successfully.', 'image-gallery' ),
] );
}
function adminEnqueueScripts($hook)
{
// The hook suffix follows the new parent: {post_type}_page_{slug}
// rather than tools_page_{slug} -- see video-gallery-block-free's
// Enqueue.php for the same shape against its own post type.
if (igbPostType::POST_TYPE . '_page_3d-image-gallery-dashboard' === $hook) {
wp_enqueue_style('ig-admin-style', BIGB_DIR_URL . 'build/admin/dashboard.css', false, BIGB_PLUGIN_VERSION);
wp_enqueue_script('ig-admin-script', BIGB_DIR_URL . 'build/admin/dashboard.js', ['react', 'react-dom', 'wp-data', "wp-api", "wp-util", "wp-i18n"], BIGB_PLUGIN_VERSION, true);
wp_localize_script('ig-admin-script', 'igAdmin', [
'ajaxUrl' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('igb_activation_nonce'),
]);
}
}
}
new igbSubMenu();