PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.4
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.4
4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 All 202 releases
← All changes | includes/Admin/Customizer/Sections/SingleDoc.php +953 -0 4.9.0 → 4.9.4 View file →
@@ -4344,8 +4344,961 @@
4344 4344 )
4345 4345 );
4346 4346 }
4347 4347
4348 + /**
4349 + * AI Actions split button.
4350 + *
4351 + * Mirrors the style controls the Gutenberg block and the Elementor widget
4352 + * already expose (see Editors/Elementor/Widget/ReadingTime.php:377-471), so the
4353 + * three surfaces stay in step. Declared physically after the reading-time group
4354 + * and sharing its priority of 155: WP_Customize_Manager::prepare_controls()
4355 + * sorts by priority then instance_number, and instance_number follows
4356 + * registration order, which Section::register() takes from get_class_methods()
4357 + * — i.e. source order. There is no free integer between 155 and the 156 "Entry
4358 + * Content" separator, and this is the same mechanism that already keeps the
4359 + * Author group above Estimated Reading Time.
4360 + */
4361 + public function doc_ai_actions_section() {
4362 + $this->customizer->add_setting(
4363 + 'betterdocs_doc_ai_actions_section',
4364 + [
4365 + 'default' => $this->defaults['betterdocs_doc_ai_actions_section'],
4366 + 'sanitize_callback' => 'esc_html'
4367 + ]
4368 + );
4369 +
4370 + $this->customizer->add_control(
4371 + new SeparatorControl(
4372 + $this->customizer,
4373 + 'betterdocs_doc_ai_actions_section',
4374 + [
4375 + 'label' => __( 'AI Actions', 'betterdocs' ),
4376 + 'priority' => 155,
4377 + 'settings' => 'betterdocs_doc_ai_actions_section',
4378 + 'section' => 'betterdocs_single_docs_settings'
4379 + ]
4380 + )
4381 + );
4382 + }
4383 +
4384 + public function betterdocs_doc_single_content_ai_actions_bg_color() {
4385 + $this->customizer->add_setting(
4386 + 'betterdocs_doc_single_content_ai_actions_bg_color',
4387 + [
4388 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_bg_color'],
4389 + 'capability' => 'edit_theme_options',
4390 + 'transport' => 'postMessage',
4391 + 'sanitize_callback' => [ $this->sanitizer, 'rgba' ]
4392 + ]
4393 + );
4394 +
4395 + $this->customizer->add_control(
4396 + new AlphaColorControl(
4397 + $this->customizer,
4398 + 'betterdocs_doc_single_content_ai_actions_bg_color',
4399 + [
4400 + 'label' => __( 'Background Color', 'betterdocs' ),
4401 + 'priority' => 155,
4402 + 'section' => 'betterdocs_single_docs_settings',
4403 + 'settings' => 'betterdocs_doc_single_content_ai_actions_bg_color'
4404 + ]
4405 + )
4406 + );
4407 + }
4408 +
4409 + public function betterdocs_doc_single_content_ai_actions_color() {
4410 + $this->customizer->add_setting(
4411 + 'betterdocs_doc_single_content_ai_actions_color',
4412 + [
4413 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_color'],
4414 + 'capability' => 'edit_theme_options',
4415 + 'transport' => 'postMessage',
4416 + 'sanitize_callback' => [ $this->sanitizer, 'rgba' ]
4417 + ]
4418 + );
4419 +
4420 + $this->customizer->add_control(
4421 + new AlphaColorControl(
4422 + $this->customizer,
4423 + 'betterdocs_doc_single_content_ai_actions_color',
4424 + [
4425 + 'label' => __( 'Font Color', 'betterdocs' ),
4426 + 'priority' => 155,
4427 + 'section' => 'betterdocs_single_docs_settings',
4428 + 'settings' => 'betterdocs_doc_single_content_ai_actions_color'
4429 + ]
4430 + )
4431 + );
4432 + }
4433 +
4434 + public function betterdocs_doc_single_content_ai_actions_font_size() {
4435 + $this->customizer->add_setting(
4436 + 'betterdocs_doc_single_content_ai_actions_font_size',
4437 + [
4438 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_font_size'],
4439 + 'capability' => 'edit_theme_options',
4440 + 'transport' => 'postMessage',
4441 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
4442 + ]
4443 + );
4444 +
4445 + $this->customizer->add_control(
4446 + new RangeValueControl(
4447 + $this->customizer,
4448 + 'betterdocs_doc_single_content_ai_actions_font_size',
4449 + [
4450 + 'type' => 'betterdocs-range-value',
4451 + 'section' => 'betterdocs_single_docs_settings',
4452 + 'settings' => 'betterdocs_doc_single_content_ai_actions_font_size',
4453 + 'label' => __( 'Font Size', 'betterdocs' ),
4454 + 'priority' => 155,
4455 + 'input_attrs' => [
4456 + 'min' => 0,
4457 + 'max' => 40,
4458 + 'step' => 1,
4459 + 'suffix' => 'px',
4460 + // The setting defaults to '' so nothing is emitted until the
4461 + // user opts in, but '' is not representable in an
4462 + // <input type="range"> — the browser coerces it to the
4463 + // min/max midpoint. This is the value ai-actions.scss actually
4464 + // paints, so the thumb starts on the truth. Read by
4465 + // customizer-range-value-control.js; never written to the setting.
4466 + 'data-unset-val' => 14
4467 + ]
4468 + ]
4469 + )
4470 + );
4471 + }
4472 +
4473 + public function betterdocs_doc_single_content_ai_actions_font_weight() {
4474 + $this->customizer->add_setting(
4475 + 'betterdocs_doc_single_content_ai_actions_font_weight',
4476 + [
4477 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_font_weight'],
4478 + 'capability' => 'edit_theme_options',
4479 + 'transport' => 'postMessage',
4480 + 'sanitize_callback' => [ $this->sanitizer, 'choices' ]
4481 + ]
4482 + );
4483 +
4484 + $this->customizer->add_control(
4485 + new WP_Customize_Control(
4486 + $this->customizer,
4487 + 'betterdocs_doc_single_content_ai_actions_font_weight',
4488 + [
4489 + 'label' => __( 'Font Weight', 'betterdocs' ),
4490 + 'section' => 'betterdocs_single_docs_settings',
4491 + 'settings' => 'betterdocs_doc_single_content_ai_actions_font_weight',
4492 + 'type' => 'select',
4493 + // The empty option has to be a real choice: Sanitizer::select()
4494 + // falls back to the setting default unless the input is a key of
4495 + // $control->choices, and '' is the default that emits nothing.
4496 + 'choices' => [
4497 + '' => __( 'Default', 'betterdocs' ),
4498 + 'normal' => 'Normal',
4499 + '100' => '100',
4500 + '200' => '200',
4501 + '300' => '300',
4502 + '400' => '400',
4503 + '500' => '500',
4504 + '600' => '600',
4505 + '700' => '700',
4506 + '800' => '800',
4507 + '900' => '900'
4508 + ],
4509 + 'priority' => 155
4510 + ]
4511 + )
4512 + );
4513 + }
4514 +
4515 + public function betterdocs_doc_single_content_ai_actions_icon_size() {
4516 + $this->customizer->add_setting(
4517 + 'betterdocs_doc_single_content_ai_actions_icon_size',
4518 + [
4519 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_icon_size'],
4520 + 'capability' => 'edit_theme_options',
4521 + 'transport' => 'postMessage',
4522 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
4523 + ]
4524 + );
4525 +
4526 + $this->customizer->add_control(
4527 + new RangeValueControl(
4528 + $this->customizer,
4529 + 'betterdocs_doc_single_content_ai_actions_icon_size',
4530 + [
4531 + 'type' => 'betterdocs-range-value',
4532 + 'section' => 'betterdocs_single_docs_settings',
4533 + 'settings' => 'betterdocs_doc_single_content_ai_actions_icon_size',
4534 + 'label' => __( 'Icon Size', 'betterdocs' ),
4535 + 'priority' => 155,
4536 + 'input_attrs' => [
4537 + 'min' => 10,
4538 + 'max' => 40,
4539 + 'step' => 1,
4540 + 'suffix' => 'px',
4541 + // Reset target, so it has to be the shipped default.
4542 + 'data-unset-val' => 14
4543 + ]
4544 + ]
4545 + )
4546 + );
4547 + }
4548 +
4549 + /**
4550 + * Icon colour. Separate from the label colour above: the copy glyph and the
4551 + * caret are the only part of the control that can carry a tint without
4552 + * turning the label into a link-coloured word, and every icon in the button
4553 + * is stroked with `currentColor`, so one `color` declaration does both.
4554 + */
4555 + public function betterdocs_doc_single_content_ai_actions_icon_color() {
4556 + $this->customizer->add_setting(
4557 + 'betterdocs_doc_single_content_ai_actions_icon_color',
4558 + [
4559 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_icon_color'],
4560 + 'capability' => 'edit_theme_options',
4561 + 'transport' => 'postMessage',
4562 + 'sanitize_callback' => [ $this->sanitizer, 'rgba' ]
4563 + ]
4564 + );
4565 +
4566 + $this->customizer->add_control(
4567 + new AlphaColorControl(
4568 + $this->customizer,
4569 + 'betterdocs_doc_single_content_ai_actions_icon_color',
4570 + [
4571 + 'label' => __( 'Icon Color', 'betterdocs' ),
4572 + 'priority' => 155,
4573 + 'section' => 'betterdocs_single_docs_settings',
4574 + 'settings' => 'betterdocs_doc_single_content_ai_actions_icon_color'
4575 + ]
4576 + )
4577 + );
4578 + }
4579 +
4580 + public function betterdocs_doc_single_content_ai_actions_border_color() {
4581 + $this->customizer->add_setting(
4582 + 'betterdocs_doc_single_content_ai_actions_border_color',
4583 + [
4584 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_border_color'],
4585 + 'capability' => 'edit_theme_options',
4586 + 'transport' => 'postMessage',
4587 + 'sanitize_callback' => [ $this->sanitizer, 'rgba' ]
4588 + ]
4589 + );
4590 +
4591 + $this->customizer->add_control(
4592 + new AlphaColorControl(
4593 + $this->customizer,
4594 + 'betterdocs_doc_single_content_ai_actions_border_color',
4595 + [
4596 + 'label' => __( 'Border Color', 'betterdocs' ),
4597 + 'priority' => 155,
4598 + 'section' => 'betterdocs_single_docs_settings',
4599 + 'settings' => 'betterdocs_doc_single_content_ai_actions_border_color'
4600 + ]
4601 + )
4602 + );
4603 + }
4604 +
4605 + public function betterdocs_doc_single_content_ai_actions_border_width() {
4606 + $this->customizer->add_setting(
4607 + 'betterdocs_doc_single_content_ai_actions_border_width',
4608 + [
4609 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_border_width'],
4610 + 'capability' => 'edit_theme_options',
4611 + 'transport' => 'postMessage',
4612 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
4613 + ]
4614 + );
4615 +
4616 + $this->customizer->add_control(
4617 + new RangeValueControl(
4618 + $this->customizer,
4619 + 'betterdocs_doc_single_content_ai_actions_border_width',
4620 + [
4621 + 'type' => 'betterdocs-range-value',
4622 + 'section' => 'betterdocs_single_docs_settings',
4623 + 'settings' => 'betterdocs_doc_single_content_ai_actions_border_width',
4624 + 'label' => __( 'Border Width', 'betterdocs' ),
4625 + 'priority' => 155,
4626 + 'input_attrs' => [
4627 + 'min' => 0,
4628 + 'max' => 10,
4629 + 'step' => 1,
4630 + 'suffix' => 'px',
4631 + // The button ships borderless, so 0 is both the default and
4632 + // what "reset" has to return to.
4633 + 'data-unset-val' => 0
4634 + ]
4635 + ]
4636 + )
4637 + );
4638 + }
4639 +
4640 + public function betterdocs_doc_single_content_ai_actions_border_radius() {
4641 + $this->customizer->add_setting(
4642 + 'betterdocs_doc_single_content_ai_actions_border_radius',
4643 + [
4644 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_border_radius'],
4645 + 'capability' => 'edit_theme_options',
4646 + 'transport' => 'postMessage',
4647 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
4648 + ]
4649 + );
4650 +
4651 + $this->customizer->add_control(
4652 + new RangeValueControl(
4653 + $this->customizer,
4654 + 'betterdocs_doc_single_content_ai_actions_border_radius',
4655 + [
4656 + 'type' => 'betterdocs-range-value',
4657 + 'section' => 'betterdocs_single_docs_settings',
4658 + 'settings' => 'betterdocs_doc_single_content_ai_actions_border_radius',
4659 + 'label' => __( 'Border Radius', 'betterdocs' ),
4660 + 'priority' => 155,
4661 + 'input_attrs' => [
4662 + 'min' => 0,
4663 + 'max' => 100,
4664 + 'step' => 1,
4665 + 'suffix' => 'px',
4666 + // The shipped corner, shared with the reading-time pill.
4667 + 'data-unset-val' => 16
4668 + ]
4669 + ]
4670 + )
4671 + );
4672 + }
4673 +
4674 + public function betterdocs_doc_single_content_ai_actions_padding() {
4675 + $this->customizer->add_setting(
4676 + 'betterdocs_doc_single_content_ai_actions_padding',
4677 + [
4678 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_padding'],
4679 + 'capability' => 'edit_theme_options',
4680 + 'transport' => 'postMessage',
4681 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
4682 + ]
4683 + );
4684 +
4685 + $this->customizer->add_control(
4686 + new TitleControl(
4687 + $this->customizer,
4688 + 'betterdocs_doc_single_content_ai_actions_padding',
4689 + [
4690 + 'type' => 'betterdocs-title',
4691 + 'section' => 'betterdocs_single_docs_settings',
4692 + 'settings' => 'betterdocs_doc_single_content_ai_actions_padding',
4693 + 'label' => __( 'Padding', 'betterdocs' ),
4694 + 'priority' => 155,
4695 + 'input_attrs' => [
4696 + 'id' => 'betterdocs_doc_single_content_ai_actions_padding',
4697 + 'class' => 'betterdocs-dimension'
4698 + ]
4699 + ]
4700 + )
4701 + );
4702 +
4703 + $this->customizer->add_setting(
4704 + 'betterdocs_doc_single_content_ai_actions_padding_top',
4705 + [
4706 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_padding_top'],
4707 + 'capability' => 'edit_theme_options',
4708 + 'transport' => 'postMessage',
4709 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
4710 + ]
4711 + );
4712 +
4713 + $this->customizer->add_control(
4714 + new DimensionControl(
4715 + $this->customizer,
4716 + 'betterdocs_doc_single_content_ai_actions_padding_top',
4717 + [
4718 + 'type' => 'betterdocs-dimension',
4719 + 'section' => 'betterdocs_single_docs_settings',
4720 + 'settings' => 'betterdocs_doc_single_content_ai_actions_padding_top',
4721 + 'label' => __( 'Top', 'betterdocs' ),
4722 + 'priority' => 155,
4723 + 'input_attrs' => [
4724 + 'class' => 'betterdocs_doc_single_content_ai_actions_padding betterdocs-dimension'
4725 + ]
4726 + ]
4727 + )
4728 + );
4729 +
4730 + $this->customizer->add_setting(
4731 + 'betterdocs_doc_single_content_ai_actions_padding_right',
4732 + [
4733 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_padding_right'],
4734 + 'capability' => 'edit_theme_options',
4735 + 'transport' => 'postMessage',
4736 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
4737 + ]
4738 + );
4739 +
4740 + $this->customizer->add_control(
4741 + new DimensionControl(
4742 + $this->customizer,
4743 + 'betterdocs_doc_single_content_ai_actions_padding_right',
4744 + [
4745 + 'type' => 'betterdocs-dimension',
4746 + 'section' => 'betterdocs_single_docs_settings',
4747 + 'settings' => 'betterdocs_doc_single_content_ai_actions_padding_right',
4748 + 'label' => __( 'Right', 'betterdocs' ),
4749 + 'priority' => 155,
4750 + 'input_attrs' => [
4751 + 'class' => 'betterdocs_doc_single_content_ai_actions_padding betterdocs-dimension'
4752 + ]
4753 + ]
4754 + )
4755 + );
4756 +
4757 + $this->customizer->add_setting(
4758 + 'betterdocs_doc_single_content_ai_actions_padding_bottom',
4759 + [
4760 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_padding_bottom'],
4761 + 'capability' => 'edit_theme_options',
4762 + 'transport' => 'postMessage',
4763 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
4764 + ]
4765 + );
4766 +
4767 + $this->customizer->add_control(
4768 + new DimensionControl(
4769 + $this->customizer,
4770 + 'betterdocs_doc_single_content_ai_actions_padding_bottom',
4771 + [
4772 + 'type' => 'betterdocs-dimension',
4773 + 'section' => 'betterdocs_single_docs_settings',
4774 + 'settings' => 'betterdocs_doc_single_content_ai_actions_padding_bottom',
4775 + 'label' => __( 'Bottom', 'betterdocs' ),
4776 + 'priority' => 155,
4777 + 'input_attrs' => [
4778 + 'class' => 'betterdocs_doc_single_content_ai_actions_padding betterdocs-dimension'
4779 + ]
4780 + ]
4781 + )
4782 + );
4783 +
4784 + $this->customizer->add_setting(
4785 + 'betterdocs_doc_single_content_ai_actions_padding_left',
4786 + [
4787 + 'default' => $this->defaults['betterdocs_doc_single_content_ai_actions_padding_left'],
4788 + 'capability' => 'edit_theme_options',
4789 + 'transport' => 'postMessage',
4790 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
4791 + ]
4792 + );
4793 +
4794 + $this->customizer->add_control(
4795 + new DimensionControl(
4796 + $this->customizer,
4797 + 'betterdocs_doc_single_content_ai_actions_padding_left',
4798 + [
4799 + 'type' => 'betterdocs-dimension',
4800 + 'section' => 'betterdocs_single_docs_settings',
4801 + 'settings' => 'betterdocs_doc_single_content_ai_actions_padding_left',
4802 + 'label' => __( 'Left', 'betterdocs' ),
4803 + 'priority' => 155,
4804 + 'input_attrs' => [
4805 + 'class' => 'betterdocs_doc_single_content_ai_actions_padding betterdocs-dimension'
4806 + ]
4807 + ]
4808 + )
4809 + );
4810 + }
4811 +
4812 +
4813 + /**
4814 + * Listen — the pill that morphs into an audio player.
4815 + *
4816 + * Mirrors the AI Actions group directly above, control for control, plus one
4817 + * of its own: Accent Color, for the player's chrome. Declared physically after
4818 + * that group and sharing its priority of 155, which is how
4819 + * WP_Customize_Manager::prepare_controls() is made to order them —
4820 + * `instance_number` follows registration order, which Section::register() takes
4821 + * from get_class_methods(), i.e. source order. There is no free integer between
4822 + * 155 and the 156 "Entry Content" separator, and this is the same mechanism that
4823 + * already keeps the Author group above Estimated Reading Time.
4824 + */
4825 + public function doc_listen_section() {
4826 + $this->customizer->add_setting(
4827 + 'betterdocs_doc_listen_section',
4828 + [
4829 + 'default' => $this->defaults['betterdocs_doc_listen_section'],
4830 + 'sanitize_callback' => 'esc_html'
4831 + ]
4832 + );
4833 +
4834 + $this->customizer->add_control(
4835 + new SeparatorControl(
4836 + $this->customizer,
4837 + 'betterdocs_doc_listen_section',
4838 + [
4839 + 'label' => __( 'Listen', 'betterdocs' ),
4840 + 'priority' => 155,
4841 + 'settings' => 'betterdocs_doc_listen_section',
4842 + 'section' => 'betterdocs_single_docs_settings'
4843 + ]
4844 + )
4845 + );
4846 + }
4847 +
4848 + public function betterdocs_doc_single_content_listen_bg_color() {
4849 + $this->customizer->add_setting(
4850 + 'betterdocs_doc_single_content_listen_bg_color',
4851 + [
4852 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_bg_color'],
4853 + 'capability' => 'edit_theme_options',
4854 + 'transport' => 'postMessage',
4855 + 'sanitize_callback' => [ $this->sanitizer, 'rgba' ]
4856 + ]
4857 + );
4858 +
4859 + $this->customizer->add_control(
4860 + new AlphaColorControl(
4861 + $this->customizer,
4862 + 'betterdocs_doc_single_content_listen_bg_color',
4863 + [
4864 + 'label' => __( 'Background Color', 'betterdocs' ),
4865 + 'priority' => 155,
4866 + 'section' => 'betterdocs_single_docs_settings',
4867 + 'settings' => 'betterdocs_doc_single_content_listen_bg_color'
4868 + ]
4869 + )
4870 + );
4871 + }
4872 +
4873 + public function betterdocs_doc_single_content_listen_color() {
4874 + $this->customizer->add_setting(
4875 + 'betterdocs_doc_single_content_listen_color',
4876 + [
4877 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_color'],
4878 + 'capability' => 'edit_theme_options',
4879 + 'transport' => 'postMessage',
4880 + 'sanitize_callback' => [ $this->sanitizer, 'rgba' ]
4881 + ]
4882 + );
4883 +
4884 + $this->customizer->add_control(
4885 + new AlphaColorControl(
4886 + $this->customizer,
4887 + 'betterdocs_doc_single_content_listen_color',
4888 + [
4889 + 'label' => __( 'Font Color', 'betterdocs' ),
4890 + 'priority' => 155,
4891 + 'section' => 'betterdocs_single_docs_settings',
4892 + 'settings' => 'betterdocs_doc_single_content_listen_color'
4893 + ]
4894 + )
4895 + );
4896 + }
4897 +
4898 + /**
4899 + * The player's chrome: the play button's fill, the progress bar's fill and the
4900 + * scrubber's ring.
4901 + *
4902 + * One control for all three because listen.scss publishes them as a single
4903 + * custom property, `--bd-listen-accent`, on `.betterdocs-listen-player`. Three
4904 + * separate controls would be three chances for a site to end up with a play
4905 + * button that does not match its own progress bar.
4906 + */
4907 + public function betterdocs_doc_single_content_listen_accent_color() {
4908 + $this->customizer->add_setting(
4909 + 'betterdocs_doc_single_content_listen_accent_color',
4910 + [
4911 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_accent_color'],
4912 + 'capability' => 'edit_theme_options',
4913 + 'transport' => 'postMessage',
4914 + 'sanitize_callback' => [ $this->sanitizer, 'rgba' ]
4915 + ]
4916 + );
4917 +
4918 + $this->customizer->add_control(
4919 + new AlphaColorControl(
4920 + $this->customizer,
4921 + 'betterdocs_doc_single_content_listen_accent_color',
4922 + [
4923 + 'label' => __( 'Player Accent Color', 'betterdocs' ),
4924 + 'description' => __( 'Used for the play button, the progress bar and its handle.', 'betterdocs' ),
4925 + 'priority' => 155,
4926 + 'section' => 'betterdocs_single_docs_settings',
4927 + 'settings' => 'betterdocs_doc_single_content_listen_accent_color'
4928 + ]
4929 + )
4930 + );
4931 + }
4932 +
4933 + public function betterdocs_doc_single_content_listen_font_size() {
4934 + $this->customizer->add_setting(
4935 + 'betterdocs_doc_single_content_listen_font_size',
4936 + [
4937 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_font_size'],
4938 + 'capability' => 'edit_theme_options',
4939 + 'transport' => 'postMessage',
4940 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
4941 + ]
4942 + );
4943 +
4944 + $this->customizer->add_control(
4945 + new RangeValueControl(
4946 + $this->customizer,
4947 + 'betterdocs_doc_single_content_listen_font_size',
4948 + [
4949 + 'type' => 'betterdocs-range-value',
4950 + 'section' => 'betterdocs_single_docs_settings',
4951 + 'settings' => 'betterdocs_doc_single_content_listen_font_size',
4952 + 'label' => __( 'Font Size', 'betterdocs' ),
4953 + 'priority' => 155,
4954 + 'input_attrs' => [
4955 + 'min' => 0,
4956 + 'max' => 40,
4957 + 'step' => 1,
4958 + 'suffix' => 'px',
4959 + // Reset target, so it has to be the value listen.scss paints.
4960 + // The player's own readout is sized in `em`, so this scales
4961 + // that with the label rather than leaving it behind.
4962 + 'data-unset-val' => 14
4963 + ]
4964 + ]
4965 + )
4966 + );
4967 + }
4968 +
4969 + public function betterdocs_doc_single_content_listen_font_weight() {
4970 + $this->customizer->add_setting(
4971 + 'betterdocs_doc_single_content_listen_font_weight',
4972 + [
4973 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_font_weight'],
4974 + 'capability' => 'edit_theme_options',
4975 + 'transport' => 'postMessage',
4976 + 'sanitize_callback' => [ $this->sanitizer, 'choices' ]
4977 + ]
4978 + );
4979 +
4980 + $this->customizer->add_control(
4981 + new WP_Customize_Control(
4982 + $this->customizer,
4983 + 'betterdocs_doc_single_content_listen_font_weight',
4984 + [
4985 + 'label' => __( 'Font Weight', 'betterdocs' ),
4986 + 'section' => 'betterdocs_single_docs_settings',
4987 + 'settings' => 'betterdocs_doc_single_content_listen_font_weight',
4988 + 'type' => 'select',
4989 + // The empty option has to be a real choice: Sanitizer::select()
4990 + // falls back to the setting default unless the input is a key of
4991 + // $control->choices, and '' is the default that emits nothing.
4992 + 'choices' => [
4993 + '' => __( 'Default', 'betterdocs' ),
4994 + 'normal' => 'Normal',
4995 + '100' => '100',
4996 + '200' => '200',
4997 + '300' => '300',
4998 + '400' => '400',
4999 + '500' => '500',
5000 + '600' => '600',
5001 + '700' => '700',
5002 + '800' => '800',
5003 + '900' => '900'
5004 + ],
5005 + 'priority' => 155
5006 + ]
5007 + )
5008 + );
5009 + }
5010 +
5011 + public function betterdocs_doc_single_content_listen_icon_size() {
5012 + $this->customizer->add_setting(
5013 + 'betterdocs_doc_single_content_listen_icon_size',
5014 + [
5015 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_icon_size'],
5016 + 'capability' => 'edit_theme_options',
5017 + 'transport' => 'postMessage',
5018 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
5019 + ]
5020 + );
5021 +
5022 + $this->customizer->add_control(
5023 + new RangeValueControl(
5024 + $this->customizer,
5025 + 'betterdocs_doc_single_content_listen_icon_size',
5026 + [
5027 + 'type' => 'betterdocs-range-value',
5028 + 'section' => 'betterdocs_single_docs_settings',
5029 + 'settings' => 'betterdocs_doc_single_content_listen_icon_size',
5030 + 'label' => __( 'Icon Size', 'betterdocs' ),
5031 + 'priority' => 155,
5032 + 'input_attrs' => [
5033 + 'min' => 10,
5034 + 'max' => 40,
5035 + 'step' => 1,
5036 + 'suffix' => 'px',
5037 + // The headset glyph on the collapsed pill only. The player's
5038 + // own glyphs are 9px and 11px by design and stay that way —
5039 + // they have to fit inside 20px circles.
5040 + 'data-unset-val' => 14
5041 + ]
5042 + ]
5043 + )
5044 + );
5045 + }
5046 +
5047 + public function betterdocs_doc_single_content_listen_icon_color() {
5048 + $this->customizer->add_setting(
5049 + 'betterdocs_doc_single_content_listen_icon_color',
5050 + [
5051 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_icon_color'],
5052 + 'capability' => 'edit_theme_options',
5053 + 'transport' => 'postMessage',
5054 + 'sanitize_callback' => [ $this->sanitizer, 'rgba' ]
5055 + ]
5056 + );
5057 +
5058 + $this->customizer->add_control(
5059 + new AlphaColorControl(
5060 + $this->customizer,
5061 + 'betterdocs_doc_single_content_listen_icon_color',
5062 + [
5063 + 'label' => __( 'Icon Color', 'betterdocs' ),
5064 + 'priority' => 155,
5065 + 'section' => 'betterdocs_single_docs_settings',
5066 + 'settings' => 'betterdocs_doc_single_content_listen_icon_color'
5067 + ]
5068 + )
5069 + );
5070 + }
5071 +
5072 + public function betterdocs_doc_single_content_listen_border_color() {
5073 + $this->customizer->add_setting(
5074 + 'betterdocs_doc_single_content_listen_border_color',
5075 + [
5076 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_border_color'],
5077 + 'capability' => 'edit_theme_options',
5078 + 'transport' => 'postMessage',
5079 + 'sanitize_callback' => [ $this->sanitizer, 'rgba' ]
5080 + ]
5081 + );
5082 +
5083 + $this->customizer->add_control(
5084 + new AlphaColorControl(
5085 + $this->customizer,
5086 + 'betterdocs_doc_single_content_listen_border_color',
5087 + [
5088 + 'label' => __( 'Border Color', 'betterdocs' ),
5089 + 'priority' => 155,
5090 + 'section' => 'betterdocs_single_docs_settings',
5091 + 'settings' => 'betterdocs_doc_single_content_listen_border_color'
5092 + ]
5093 + )
5094 + );
5095 + }
5096 +
5097 + public function betterdocs_doc_single_content_listen_border_width() {
5098 + $this->customizer->add_setting(
5099 + 'betterdocs_doc_single_content_listen_border_width',
5100 + [
5101 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_border_width'],
5102 + 'capability' => 'edit_theme_options',
5103 + 'transport' => 'postMessage',
5104 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
5105 + ]
5106 + );
5107 +
5108 + $this->customizer->add_control(
5109 + new RangeValueControl(
5110 + $this->customizer,
5111 + 'betterdocs_doc_single_content_listen_border_width',
5112 + [
5113 + 'type' => 'betterdocs-range-value',
5114 + 'section' => 'betterdocs_single_docs_settings',
5115 + 'settings' => 'betterdocs_doc_single_content_listen_border_width',
5116 + 'label' => __( 'Border Width', 'betterdocs' ),
5117 + 'priority' => 155,
5118 + 'input_attrs' => [
5119 + 'min' => 0,
5120 + 'max' => 10,
5121 + 'step' => 1,
5122 + 'suffix' => 'px',
5123 + 'data-unset-val' => 0
5124 + ]
5125 + ]
5126 + )
5127 + );
5128 + }
5129 +
5130 + public function betterdocs_doc_single_content_listen_border_radius() {
5131 + $this->customizer->add_setting(
5132 + 'betterdocs_doc_single_content_listen_border_radius',
5133 + [
5134 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_border_radius'],
5135 + 'capability' => 'edit_theme_options',
5136 + 'transport' => 'postMessage',
5137 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
5138 + ]
5139 + );
5140 +
5141 + $this->customizer->add_control(
5142 + new RangeValueControl(
5143 + $this->customizer,
5144 + 'betterdocs_doc_single_content_listen_border_radius',
5145 + [
5146 + 'type' => 'betterdocs-range-value',
5147 + 'section' => 'betterdocs_single_docs_settings',
5148 + 'settings' => 'betterdocs_doc_single_content_listen_border_radius',
5149 + 'label' => __( 'Border Radius', 'betterdocs' ),
5150 + 'priority' => 155,
5151 + 'input_attrs' => [
5152 + 'min' => 0,
5153 + 'max' => 100,
5154 + 'step' => 1,
5155 + 'suffix' => 'px',
5156 + 'data-unset-val' => 16
5157 + ]
5158 + ]
5159 + )
5160 + );
5161 + }
5162 +
5163 + public function betterdocs_doc_single_content_listen_padding() {
5164 + $this->customizer->add_setting(
5165 + 'betterdocs_doc_single_content_listen_padding',
5166 + [
5167 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_padding'],
5168 + 'capability' => 'edit_theme_options',
5169 + 'transport' => 'postMessage',
5170 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
5171 + ]
5172 + );
5173 +
5174 + $this->customizer->add_control(
5175 + new TitleControl(
5176 + $this->customizer,
5177 + 'betterdocs_doc_single_content_listen_padding',
5178 + [
5179 + 'type' => 'betterdocs-title',
5180 + 'section' => 'betterdocs_single_docs_settings',
5181 + 'settings' => 'betterdocs_doc_single_content_listen_padding',
5182 + 'label' => __( 'Padding', 'betterdocs' ),
5183 + 'priority' => 155,
5184 + 'input_attrs' => [
5185 + 'id' => 'betterdocs_doc_single_content_listen_padding',
5186 + 'class' => 'betterdocs-dimension'
5187 + ]
5188 + ]
5189 + )
5190 + );
5191 +
5192 + $this->customizer->add_setting(
5193 + 'betterdocs_doc_single_content_listen_padding_top',
5194 + [
5195 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_padding_top'],
5196 + 'capability' => 'edit_theme_options',
5197 + 'transport' => 'postMessage',
5198 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
5199 + ]
5200 + );
5201 +
5202 + $this->customizer->add_control(
5203 + new DimensionControl(
5204 + $this->customizer,
5205 + 'betterdocs_doc_single_content_listen_padding_top',
5206 + [
5207 + 'type' => 'betterdocs-dimension',
5208 + 'section' => 'betterdocs_single_docs_settings',
5209 + 'settings' => 'betterdocs_doc_single_content_listen_padding_top',
5210 + 'label' => __( 'Top', 'betterdocs' ),
5211 + 'priority' => 155,
5212 + 'input_attrs' => [
5213 + 'class' => 'betterdocs_doc_single_content_listen_padding betterdocs-dimension'
5214 + ]
5215 + ]
5216 + )
5217 + );
5218 +
5219 + $this->customizer->add_setting(
5220 + 'betterdocs_doc_single_content_listen_padding_right',
5221 + [
5222 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_padding_right'],
5223 + 'capability' => 'edit_theme_options',
5224 + 'transport' => 'postMessage',
5225 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
5226 + ]
5227 + );
5228 +
5229 + $this->customizer->add_control(
5230 + new DimensionControl(
5231 + $this->customizer,
5232 + 'betterdocs_doc_single_content_listen_padding_right',
5233 + [
5234 + 'type' => 'betterdocs-dimension',
5235 + 'section' => 'betterdocs_single_docs_settings',
5236 + 'settings' => 'betterdocs_doc_single_content_listen_padding_right',
5237 + 'label' => __( 'Right', 'betterdocs' ),
5238 + 'priority' => 155,
5239 + 'input_attrs' => [
5240 + 'class' => 'betterdocs_doc_single_content_listen_padding betterdocs-dimension'
5241 + ]
5242 + ]
5243 + )
5244 + );
5245 +
5246 + $this->customizer->add_setting(
5247 + 'betterdocs_doc_single_content_listen_padding_bottom',
5248 + [
5249 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_padding_bottom'],
5250 + 'capability' => 'edit_theme_options',
5251 + 'transport' => 'postMessage',
5252 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
5253 + ]
5254 + );
5255 +
5256 + $this->customizer->add_control(
5257 + new DimensionControl(
5258 + $this->customizer,
5259 + 'betterdocs_doc_single_content_listen_padding_bottom',
5260 + [
5261 + 'type' => 'betterdocs-dimension',
5262 + 'section' => 'betterdocs_single_docs_settings',
5263 + 'settings' => 'betterdocs_doc_single_content_listen_padding_bottom',
5264 + 'label' => __( 'Bottom', 'betterdocs' ),
5265 + 'priority' => 155,
5266 + 'input_attrs' => [
5267 + 'class' => 'betterdocs_doc_single_content_listen_padding betterdocs-dimension'
5268 + ]
5269 + ]
5270 + )
5271 + );
5272 +
5273 + $this->customizer->add_setting(
5274 + 'betterdocs_doc_single_content_listen_padding_left',
5275 + [
5276 + 'default' => $this->defaults['betterdocs_doc_single_content_listen_padding_left'],
5277 + 'capability' => 'edit_theme_options',
5278 + 'transport' => 'postMessage',
5279 + 'sanitize_callback' => [ $this->sanitizer, 'integer' ]
5280 + ]
5281 + );
5282 +
5283 + $this->customizer->add_control(
5284 + new DimensionControl(
5285 + $this->customizer,
5286 + 'betterdocs_doc_single_content_listen_padding_left',
5287 + [
5288 + 'type' => 'betterdocs-dimension',
5289 + 'section' => 'betterdocs_single_docs_settings',
5290 + 'settings' => 'betterdocs_doc_single_content_listen_padding_left',
5291 + 'label' => __( 'Left', 'betterdocs' ),
5292 + 'priority' => 155,
5293 + 'input_attrs' => [
5294 + 'class' => 'betterdocs_doc_single_content_listen_padding betterdocs-dimension'
5295 + ]
5296 + ]
5297 + )
5298 + );
5299 + }
5300 +
4348 5301 public function doc_single_entry_content() {
4349 5302 $this->customizer->add_setting(
4350 5303 'betterdocs_doc_single_entry_content',
4351 5304 [