@@ -24,11 +24,6 @@ function setup() {
2424 add_action ( 'init ' , $ n ( 'init ' ) );
2525 add_action ( 'admin_enqueue_scripts ' , $ n ( 'admin_scripts ' ) );
2626
27- // Editor styles. add_editor_style() doesn't work outside of a theme.
28- add_filter ( 'mce_css ' , $ n ( 'mce_css ' ) );
29- // Hook to allow async or defer on asset loading.
30- add_filter ( 'script_loader_tag ' , $ n ( 'script_loader_tag ' ), 10 , 2 );
31-
3227 add_action ( 'plugins_loaded ' , $ n ( 'maybe_load_features ' ), 11 );
3328
3429 add_filter ( 'ep_user_register_feature ' , '__return_false ' );
@@ -138,56 +133,6 @@ function admin_scripts() {
138133 );
139134}
140135
141- /**
142- * Enqueue editor styles. Filters the comma-delimited list of stylesheets to load in TinyMCE.
143- *
144- * @param string $stylesheets Comma-delimited list of stylesheets.
145- * @return string
146- */
147- function mce_css ( $ stylesheets ) {
148- if ( ! empty ( $ stylesheets ) ) {
149- $ stylesheets .= ', ' ;
150- }
151-
152- return $ stylesheets . ELASTICPRESS_LABS_URL . ( ( defined ( 'SCRIPT_DEBUG ' ) && SCRIPT_DEBUG ) ?
153- 'assets/css/frontend/editor-style.css ' :
154- 'dist/css/editor-style.min.css ' );
155- }
156-
157- /**
158- * Add async/defer attributes to enqueued scripts that have the specified script_execution flag.
159- *
160- * @link https://core.trac.wordpress.org/ticket/12009
161- * @param string $tag The script tag.
162- * @param string $handle The script handle.
163- * @return string
164- */
165- function script_loader_tag ( $ tag , $ handle ) {
166- $ script_execution = wp_scripts ()->get_data ( $ handle , 'script_execution ' );
167-
168- if ( ! $ script_execution ) {
169- return $ tag ;
170- }
171-
172- if ( 'async ' !== $ script_execution && 'defer ' !== $ script_execution ) {
173- return $ tag ;
174- }
175-
176- // Abort adding async/defer for scripts that have this script as a dependency. _doing_it_wrong()?
177- foreach ( wp_scripts ()->registered as $ script ) {
178- if ( in_array ( $ handle , $ script ->deps , true ) ) {
179- return $ tag ;
180- }
181- }
182-
183- // Add the attribute if it hasn't already been added.
184- if ( ! preg_match ( ":\s $ script_execution(=|>|\s): " , $ tag ) ) {
185- $ tag = preg_replace ( ':(?=></script>): ' , " $ script_execution " , $ tag , 1 );
186- }
187-
188- return $ tag ;
189- }
190-
191136/**
192137 * Check if minimum ElasticPress requirements are met before loading the plugin feature.
193138 */
0 commit comments