+ "code": "<?php\nrequire_once 'wordpress/wp-load.php';\n$dir = WP_CONTENT_DIR . '/mu-plugins';\nif ( ! is_dir( $dir ) ) {\n\twp_mkdir_p( $dir );\n}\n$file = $dir . '/blockparty-modal-playground-svg-kses.php';\n$lines = array(\n\t'<?php',\n\t'add_filter( \\'wp_kses_allowed_html\\', function( $tags, $context ) {',\n\t'\tif ( \\'post\\' !== $context ) {',\n\t'\t\treturn $tags;',\n\t'\t}',\n\t'\t$tags[\\'dialog\\'] = array(',\n\t'\t\t\\'aria-modal\\' => true,',\n\t'\t\t\\'class\\' => true,',\n\t'\t\t\\'style\\' => true,',\n\t'\t\t\\'id\\' => true,',\n\t'\t\t\\'closedby\\' => true,',\n\t'\t);',\n\t'\t$tags[\\'svg\\'] = array(',\n\t'\t\t\\'xmlns\\' => true,',\n\t'\t\t\\'viewbox\\' => true,',\n\t'\t\t\\'width\\' => true,',\n\t'\t\t\\'height\\' => true,',\n\t'\t\t\\'fill\\' => true,',\n\t'\t\t\\'class\\' => true,',\n\t'\t\t\\'aria-hidden\\' => true,',\n\t'\t\t\\'role\\' => true,',\n\t'\t\t\\'focusable\\' => true,',\n\t'\t);',\n\t'\t$tags[\\'path\\'] = array(',\n\t'\t\t\\'d\\' => true,',\n\t'\t\t\\'fill\\' => true,',\n\t'\t\t\\'class\\' => true,',\n\t'\t);',\n\t'\treturn $tags;',\n\t'}, 10, 2 );',\n);\nfile_put_contents( $file, implode( \"\\n\", $lines ) . \"\\n\" );\necho file_exists( $file ) ? 'mu-plugin installed' : 'mu-plugin failed';\n?>"
0 commit comments