Нема описа

custom-css.php 2.2KB

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