PageRenderTime 53ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/public/wp-content/plugins/events-calendar-pro/src/Tribe/Customizer/Section_General_Theme.php

https://gitlab.com/kath.de/cibedo_cibedo.de
PHP | 116 lines | 76 code | 11 blank | 29 comment | 2 complexity | fa30857dd773c50c9dde57e691f3e546 MD5 | raw file
  1. <?php
  2. // Don't load directly.
  3. if ( ! defined( 'ABSPATH' ) ) {
  4. die( '-1' );
  5. }
  6. /**
  7. * The Events Calendar Customizer Section Class
  8. * General Theme
  9. *
  10. * @package Events Pro
  11. * @subpackage Customizer
  12. * @since 4.0
  13. */
  14. final class Tribe__Events__Pro__Customizer__Section_General_Theme extends Tribe__Events__Pro__Customizer__Section {
  15. /**
  16. * PHP 5.2 method of creating "instances" of an abstract require this
  17. *
  18. * Note: This is the only required method for a Connector to work
  19. *
  20. * @return self The dynamic instance of this Class
  21. */
  22. public static function instance( $name = null ) {
  23. return parent::instance( __CLASS__ );
  24. }
  25. /**
  26. * Grab the CSS rules template
  27. *
  28. * @return string
  29. */
  30. public function get_css_template( $template ) {
  31. $customizer = Tribe__Events__Pro__Customizer__Main::instance();
  32. if ( $customizer->has_option( $this->ID, 'accent_color' ) ) {
  33. $template .= '
  34. .tribe-events-calendar td.tribe-events-present div[id*="tribe-events-daynum-"],
  35. #tribe_events_filters_wrapper input[type=submit],
  36. .tribe-events-button,
  37. #tribe-events .tribe-events-button,
  38. .tribe-events-button.tribe-inactive,
  39. #tribe-events .tribe-events-button:hover,
  40. .tribe-events-button:hover,
  41. .tribe-events-button.tribe-active:hover {
  42. background-color: <%= general_theme.accent_color %>;
  43. }
  44. #tribe-events-content .tribe-events-tooltip h4,
  45. #tribe_events_filters_wrapper .tribe_events_slider_val,
  46. .single-tribe_events a.tribe-events-ical,
  47. .single-tribe_events a.tribe-events-gcal {
  48. color: <%= general_theme.accent_color %>;
  49. }
  50. .tribe-grid-allday .tribe-events-week-allday-single,
  51. .tribe-grid-body .tribe-events-week-hourly-single,
  52. .tribe-grid-allday .tribe-events-week-allday-single:hover,
  53. .tribe-grid-body .tribe-events-week-hourly-single:hover {
  54. background-color: <%= general_theme.accent_color %>;
  55. border-color: rgba(0, 0, 0, 0.3);
  56. }
  57. ';
  58. }
  59. return $template;
  60. }
  61. public function setup() {
  62. $this->defaults = array(
  63. 'base_color_scheme' => 'light',
  64. 'accent_color' => '#21759b',
  65. );
  66. $this->arguments = array(
  67. 'priority' => 10,
  68. 'capability' => 'edit_theme_options',
  69. 'title' => esc_html__( 'General Theme', 'tribe-events-calendar-pro' ),
  70. 'description' => esc_html__( 'Global configurations for the styling of The Events Calendar', 'tribe-events-calendar-pro' ),
  71. );
  72. }
  73. /**
  74. * Create the Fields/Settings for this sections
  75. *
  76. * @param WP_Customize_Section $section The WordPress section instance
  77. * @param WP_Customize_Manager $manager [description]
  78. *
  79. * @return void
  80. */
  81. public function register_settings( WP_Customize_Section $section, WP_Customize_Manager $manager ) {
  82. $customizer = Tribe__Events__Pro__Customizer__Main::instance();
  83. $manager->add_setting(
  84. $customizer->get_setting_name( 'accent_color', $section ),
  85. array(
  86. 'default' => $this->get_default( 'accent_color' ),
  87. 'type' => 'option',
  88. 'sanitize_callback' => 'sanitize_hex_color',
  89. 'sanitize_js_callback' => 'maybe_hash_hex_color',
  90. )
  91. );
  92. $manager->add_control(
  93. new WP_Customize_Color_Control(
  94. $manager,
  95. $customizer->get_setting_name( 'accent_color', $section ),
  96. array(
  97. 'label' => esc_html__( 'Accent Color', 'tribe-events-calendar-pro' ),
  98. 'section' => $section->id,
  99. )
  100. )
  101. );
  102. }
  103. }