* element, so < > and & are hex-escaped. If encoding fails anyway, * an empty object lets the script fall back to its defaults instead * of printing a syntax error. */ $settings = wp_json_encode( Rotatile_Settings::get_settings_for_script(), JSON_HEX_TAG | JSON_HEX_AMP ); wp_add_inline_script( self::EDITOR_SCRIPT_HANDLE, 'window.rotatileSettings = ' . ( false === $settings ? '{}' : $settings ) . ';', 'before' ); // No path argument: translations come from the language packs that // translate.wordpress.org publishes to wp-content/languages/plugins/. wp_set_script_translations( self::EDITOR_SCRIPT_HANDLE, 'rotatile' ); } }