get_content(); // phpcs:enable } /** * Includes the Plugins WYSIWYG editor script. * * @param string[] $plugins Scripts to be included by the editor. * @return string[] * * @since 1.5.0 * @todo Should this be `static`? */ public static function include_scripts( array $plugins ): array { $plugins['footnotes'] = plugins_url( '/../admin/js/wysiwyg-editor' . ( ( PRODUCTION_ENV ) ? '.min' : '' ) . '.js', __FILE__ ); return $plugins; } /** * AJAX Callback function when the Footnotes Button is clicked. Either in the Plain text or Visual editor. * Returns an JSON encoded array with the Footnotes start and end short code. * * @since 1.5.0 */ public static function ajax_callback(): void { // Get start and end tag for the footnotes short code. $starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START ); $ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END ); if ( 'userdefined' === $starting_tag || 'userdefined' === $ending_tag ) { $starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); $ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); } echo wp_json_encode( array( 'start' => htmlspecialchars( $starting_tag ), 'end' => htmlspecialchars( $ending_tag ), ) ); exit; } }