PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 11.4
Jetpack – WP Security, Backup, Speed, & Growth v11.4
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / modules / custom-css.php

custom-css.php in Jetpack – WP Security, Backup, Speed, & Growth 11.4, at modules/custom-css.php

75 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2
3 /**
4 * Module Name: Custom CSS
5 * Module Description: Adds options for CSS preprocessor use, disabling the theme's CSS, or custom image width.
6 * Sort Order: 2
7 * First Introduced: 1.7
8 * Requires Connection: No
9 * Auto Activate: No
10 * Module Tags: Appearance
11 * Feature: Appearance
12 * Additional Search Queries: css, customize, custom, style, editor, less, sass, preprocessor, font, mobile, appearance, theme, stylesheet
13 */
14
15 /**
16 * Load custom CSS
17 */
18 function jetpack_load_custom_css() {
19 // If WordPress has the core version of Custom CSS, load our new version.
20 // @see https://core.trac.wordpress.org/changeset/38829
21 if ( function_exists( 'wp_get_custom_css' ) ) {
22 if ( ! function_exists( 'wp_update_custom_css_post' ) ) {
23 wp_die( 'Please run a SVN up to get the latest version of trunk, or update to at least 4.7 RC1' );
24 }
25 if ( ! Jetpack_Options::get_option( 'custom_css_4.7_migration' ) ) {
26 include_once __DIR__ . '/custom-css/migrate-to-core.php';
27 } else { // TODO: DELETE THIS.
28 if ( defined( 'WP_CLI' ) && WP_CLI ) {
29 WP_CLI::add_command(
30 'jetpack custom-css undo-migrate',
31 function () {
32 Jetpack_Options::delete_option( 'custom_css_4.7_migration' );
33 WP_CLI::success( __( 'Option deleted, re-migrate via `wp jetpack custom-css migrate`.', 'jetpack' ) );
34 }
35 );
36 }
37 }
38 // TODO: END DELETE THIS.
39
40 include_once __DIR__ . '/custom-css/custom-css/preprocessors.php';
41 include_once __DIR__ . '/custom-css/custom-css-4.7.php';
42 return;
43 }
44
45 include_once __DIR__ . '/custom-css/custom-css.php';
46 add_action( 'init', array( 'Jetpack_Custom_CSS', 'init' ) );
47 }
48
49 add_action( 'jetpack_modules_loaded', 'custom_css_loaded' );
50
51 /**
52 * Enable CSS module.
53 */
54 function custom_css_loaded() {
55 Jetpack::enable_module_configurable( __FILE__ );
56 add_filter( 'jetpack_module_configuration_url_custom-css', 'jetpack_custom_css_configuration_url' );
57
58 }
59
60 /**
61 * Overrides default configuration url
62 *
63 * @uses admin_url
64 *
65 * @param string $default_url - the default URL.
66 * @return string module settings URL
67 */
68 function jetpack_custom_css_configuration_url( $default_url ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
69 return Jetpack_Custom_CSS_Enhancements::customizer_link(
70 array( 'return_url' => wp_get_referer() )
71 );
72 }
73
74 jetpack_load_custom_css();
75