.js). This plugin does neither. It does three * things: * * 1. Connects to a Zyff account, once, when an administrator asks it to * (includes/class-zyff-widgets-connect.php). Until then it contacts no * external server at all. * 2. Lists that account's saved widgets for the block editor and the * settings page (includes/class-zyff-widgets-api.php, -rest.php). The * Zyff token never leaves this server. * 3. Prints the embed container a widget needs and enqueues its runtime * (includes/class-zyff-widgets-embed.php) — the same two lines a person * would paste by hand. * * Rendering needs only a widget's public id, never the connection. A page * keeps working after Disconnect, and while Zyff's API is unreachable. * * The plugin never prints a credit or "powered by" link. Where a Zyff plan * includes attribution, Zyff's own runtime adds it as part of the service. */ if ( ! defined( 'ABSPATH' ) ) { exit; } define( 'ZYFF_WIDGETS_VERSION', '1.0.0' ); define( 'ZYFF_WIDGETS_FILE', __FILE__ ); define( 'ZYFF_WIDGETS_DIR', plugin_dir_path( __FILE__ ) ); define( 'ZYFF_WIDGETS_URL', plugin_dir_url( __FILE__ ) ); /* * The Zyff origin. Fixed for real sites; a developer running Zyff locally can * point the plugin at it from wp-config.php: * * define( 'ZYFF_WIDGETS_ORIGIN', 'http://localhost:3000' ); * * Deliberately not a setting in wp-admin: the runtime script is loaded from * this origin on every page that shows a widget, so it must not be something * a compromised admin account or a stray option can change. */ if ( ! defined( 'ZYFF_WIDGETS_ORIGIN' ) ) { define( 'ZYFF_WIDGETS_ORIGIN', 'https://www.zyff.app' ); } require_once ZYFF_WIDGETS_DIR . 'includes/class-zyff-widgets-api.php'; require_once ZYFF_WIDGETS_DIR . 'includes/class-zyff-widgets-embed.php'; require_once ZYFF_WIDGETS_DIR . 'includes/class-zyff-widgets-connect.php'; require_once ZYFF_WIDGETS_DIR . 'includes/class-zyff-widgets-rest.php'; Zyff_Widgets_Embed::init(); Zyff_Widgets_Connect::init(); Zyff_Widgets_REST::init(); /** * Register the block from its block.json. The block is dynamic: it saves only * a widget's public id and type, and render.php prints the embed. */ function zyff_widgets_register_block() { register_block_type( ZYFF_WIDGETS_DIR . 'blocks/widget' ); } add_action( 'init', 'zyff_widgets_register_block' ); /** * A "Settings" link beside Deactivate on the Plugins screen. * * @param string[] $links Existing action links. * @return string[] */ function zyff_widgets_action_links( $links ) { $url = admin_url( 'options-general.php?page=' . Zyff_Widgets_Connect::PAGE ); array_unshift( $links, '' . esc_html__( 'Settings', 'zyff-widgets' ) . '' ); return $links; } add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'zyff_widgets_action_links' );