← All changes
|
admin/section/class-convertkit-admin-section-broadcasts.php
+33
-41
3.4.2
→
2.7.4
View file →
| @@ -27,10 +27,10 @@ | ||
| 27 | 27 | // Define the settings key. |
| 28 | 28 | $this->settings_key = $this->settings::SETTINGS_NAME; |
| 29 | 29 | |
| 30 | 30 | // Define the programmatic name, Title and Tab Text. |
| 31 | - $this->name = $this->settings->get_name(); | |
| 32 | - $this->title = $this->settings->get_title(); | |
| 31 | + $this->name = 'broadcasts'; | |
| 32 | + $this->title = __( 'Broadcasts', 'convertkit' ); | |
| 33 | 33 | $this->tab_text = __( 'Broadcasts', 'convertkit' ); |
| 34 | 34 | |
| 35 | 35 | // Identify that this is beta functionality. |
| 36 | 36 | $this->is_beta = true; |
| @@ -47,8 +47,9 @@ | ||
| 47 | 47 | // Register and maybe output notices for this settings screen, and the Intercom messenger. |
| 48 | 48 | if ( $this->on_settings_screen( $this->name ) ) { |
| 49 | 49 | add_filter( 'convertkit_settings_base_register_notices', array( $this, 'register_notices' ) ); |
| 50 | 50 | add_action( 'convertkit_settings_base_render_before', array( $this, 'maybe_output_notices' ) ); |
| 51 | + add_action( 'admin_footer', array( $this, 'output_intercom' ) ); | |
| 51 | 52 | } |
| 52 | 53 | |
| 53 | 54 | // Enqueue scripts and CSS. |
| 54 | 55 | add_action( 'convertkit_admin_settings_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
| @@ -381,9 +382,9 @@ | ||
| 381 | 382 | * @return string Documentation URL. |
| 382 | 383 | */ |
| 383 | 384 | public function documentation_url() { |
| 384 | 385 | |
| 385 | - return 'https://help.kit.com/en/articles/9669096-publish-broadcasts-as-wordpress-posts-and-vice-versa'; | |
| 386 | + return 'https://help.kit.com/en/articles/2502591-the-convertkit-wordpress-plugin'; | |
| 386 | 387 | |
| 387 | 388 | } |
| 388 | 389 | |
| 389 | 390 | /** |
| @@ -395,14 +396,14 @@ | ||
| 395 | 396 | */ |
| 396 | 397 | public function enable_callback( $args ) { |
| 397 | 398 | |
| 398 | 399 | // Output field. |
| 399 | - $this->output_checkbox_field( | |
| 400 | + echo $this->get_checkbox_field( // phpcs:ignore WordPress.Security.EscapeOutput | |
| 400 | 401 | $args['name'], |
| 401 | 402 | 'on', |
| 402 | - $this->settings->enabled(), | |
| 403 | - $args['label'], | |
| 404 | - $args['description'], | |
| 403 | + $this->settings->enabled(), // phpcs:ignore WordPress.Security.EscapeOutput | |
| 404 | + $args['label'], // phpcs:ignore WordPress.Security.EscapeOutput | |
| 405 | + $args['description'], // phpcs:ignore WordPress.Security.EscapeOutput | |
| 405 | 406 | array( 'convertkit-conditional-display' ) |
| 406 | 407 | ); |
| 407 | 408 | |
| 408 | 409 | } |
| @@ -423,13 +424,9 @@ | ||
| 423 | 424 | ), |
| 424 | 425 | 'options-general.php' |
| 425 | 426 | ); |
| 426 | 427 | |
| 427 | - $this->output_link_button( | |
| 428 | - $import_url, | |
| 429 | - __( 'Import now', 'convertkit' ), | |
| 430 | - array( 'button-secondary', 'enabled' ) | |
| 431 | - ); | |
| 428 | + echo '<a href="' . esc_url( $import_url ) . '" class="button button-secondary enabled">' . esc_html__( 'Import now', 'convertkit' ) . '</a>'; | |
| 432 | 429 | |
| 433 | 430 | } |
| 434 | 431 | |
| 435 | 432 | /** |
| @@ -440,11 +437,10 @@ | ||
| 440 | 437 | * @param array $args Setting field arguments (name,description). |
| 441 | 438 | */ |
| 442 | 439 | public function post_status_callback( $args ) { |
| 443 | 440 | |
| 444 | - // Output field. | |
| 445 | - echo '<div class="convertkit-select2-container">'; | |
| 446 | - $this->output_select_field( | |
| 441 | + // Build field. | |
| 442 | + $select_field = $this->get_select_field( | |
| 447 | 443 | $args['name'], |
| 448 | 444 | $this->settings->post_status(), |
| 449 | 445 | get_post_statuses(), |
| 450 | 446 | $args['description'], |
| @@ -452,10 +448,12 @@ | ||
| 452 | 448 | 'enabled', |
| 453 | 449 | 'convertkit-select2', |
| 454 | 450 | ) |
| 455 | 451 | ); |
| 456 | - echo '</div>'; | |
| 457 | 452 | |
| 453 | + // Output field. | |
| 454 | + echo '<div class="convertkit-select2-container">' . $select_field . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput | |
| 455 | + | |
| 458 | 456 | } |
| 459 | 457 | |
| 460 | 458 | /** |
| 461 | 459 | * Renders the input for the author setting. |
| @@ -478,12 +476,9 @@ | ||
| 478 | 476 | ) |
| 479 | 477 | ); |
| 480 | 478 | |
| 481 | 479 | // Output field. |
| 482 | - echo wp_kses( | |
| 483 | - '<div class="convertkit-select2-container">' . $select_field . '</div>' . $this->get_description( $args['description'] ), | |
| 484 | - convertkit_kses_allowed_html() | |
| 485 | - ); | |
| 480 | + echo '<div class="convertkit-select2-container">' . $select_field . '</div>' . $this->get_description( $args['description'] ); // phpcs:ignore WordPress.Security.EscapeOutput | |
| 486 | 481 | |
| 487 | 482 | } |
| 488 | 483 | |
| 489 | 484 | /** |
| @@ -510,12 +505,9 @@ | ||
| 510 | 505 | ) |
| 511 | 506 | ); |
| 512 | 507 | |
| 513 | 508 | // Output field. |
| 514 | - echo wp_kses( | |
| 515 | - '<div class="convertkit-select2-container">' . $select_field . '</div>' . $this->get_description( $args['description'] ), | |
| 516 | - convertkit_kses_allowed_html() | |
| 517 | - ); | |
| 509 | + echo '<div class="convertkit-select2-container">' . $select_field . '</div>' . $this->get_description( $args['description'] ); // phpcs:ignore WordPress.Security.EscapeOutput | |
| 518 | 510 | |
| 519 | 511 | } |
| 520 | 512 | |
| 521 | 513 | /** |
| @@ -527,14 +519,14 @@ | ||
| 527 | 519 | */ |
| 528 | 520 | public function import_thumbnail_callback( $args ) { |
| 529 | 521 | |
| 530 | 522 | // Output field. |
| 531 | - $this->output_checkbox_field( | |
| 523 | + echo $this->get_checkbox_field( // phpcs:ignore WordPress.Security.EscapeOutput | |
| 532 | 524 | $args['name'], |
| 533 | 525 | 'on', |
| 534 | - $this->settings->import_thumbnail(), | |
| 535 | - $args['label'], | |
| 536 | - $args['description'], | |
| 526 | + $this->settings->import_thumbnail(), // phpcs:ignore WordPress.Security.EscapeOutput | |
| 527 | + $args['label'], // phpcs:ignore WordPress.Security.EscapeOutput | |
| 528 | + $args['description'], // phpcs:ignore WordPress.Security.EscapeOutput | |
| 537 | 529 | array( |
| 538 | 530 | 'enabled', |
| 539 | 531 | ) |
| 540 | 532 | ); |
| @@ -550,14 +542,14 @@ | ||
| 550 | 542 | */ |
| 551 | 543 | public function import_images_callback( $args ) { |
| 552 | 544 | |
| 553 | 545 | // Output field. |
| 554 | - $this->output_checkbox_field( | |
| 546 | + echo $this->get_checkbox_field( // phpcs:ignore WordPress.Security.EscapeOutput | |
| 555 | 547 | $args['name'], |
| 556 | 548 | 'on', |
| 557 | - $this->settings->import_images(), | |
| 558 | - $args['label'], | |
| 559 | - $args['description'], | |
| 549 | + $this->settings->import_images(), // phpcs:ignore WordPress.Security.EscapeOutput | |
| 550 | + $args['label'], // phpcs:ignore WordPress.Security.EscapeOutput | |
| 551 | + $args['description'], // phpcs:ignore WordPress.Security.EscapeOutput | |
| 560 | 552 | array( |
| 561 | 553 | 'enabled', |
| 562 | 554 | ) |
| 563 | 555 | ); |
| @@ -573,12 +565,12 @@ | ||
| 573 | 565 | */ |
| 574 | 566 | public function date_callback( $args ) { |
| 575 | 567 | |
| 576 | 568 | // Output field. |
| 577 | - $this->output_date_field( | |
| 569 | + echo $this->get_date_field( // phpcs:ignore WordPress.Security.EscapeOutput | |
| 578 | 570 | $args['name'], |
| 579 | 571 | esc_attr( $this->settings->published_at_min_date() ), |
| 580 | - $args['description'], | |
| 572 | + $args['description'], // phpcs:ignore WordPress.Security.EscapeOutput | |
| 581 | 573 | array( |
| 582 | 574 | 'enabled', |
| 583 | 575 | ) |
| 584 | 576 | ); |
| @@ -594,13 +586,13 @@ | ||
| 594 | 586 | */ |
| 595 | 587 | public function enable_export_callback( $args ) { |
| 596 | 588 | |
| 597 | 589 | // Output field. |
| 598 | - $this->output_checkbox_field( | |
| 590 | + echo $this->get_checkbox_field( // phpcs:ignore WordPress.Security.EscapeOutput | |
| 599 | 591 | $args['name'], |
| 600 | 592 | 'on', |
| 601 | - $this->settings->enabled_export(), | |
| 602 | - $args['label'] | |
| 593 | + $this->settings->enabled_export(), // phpcs:ignore WordPress.Security.EscapeOutput | |
| 594 | + $args['label'] // phpcs:ignore WordPress.Security.EscapeOutput | |
| 603 | 595 | ); |
| 604 | 596 | |
| 605 | 597 | } |
| 606 | 598 | |
| @@ -613,13 +605,13 @@ | ||
| 613 | 605 | */ |
| 614 | 606 | public function no_styles_callback( $args ) { |
| 615 | 607 | |
| 616 | 608 | // Output field. |
| 617 | - $this->output_checkbox_field( | |
| 609 | + echo $this->get_checkbox_field( // phpcs:ignore WordPress.Security.EscapeOutput | |
| 618 | 610 | $args['name'], |
| 619 | 611 | 'on', |
| 620 | - $this->settings->no_styles(), | |
| 621 | - $args['description'] | |
| 612 | + $this->settings->no_styles(), // phpcs:ignore WordPress.Security.EscapeOutput | |
| 613 | + $args['description'] // phpcs:ignore WordPress.Security.EscapeOutput | |
| 622 | 614 | ); |
| 623 | 615 | |
| 624 | 616 | } |
| 625 | 617 | |
| @@ -657,9 +649,9 @@ | ||
| 657 | 649 | |
| 658 | 650 | } |
| 659 | 651 | |
| 660 | 652 | // Bootstrap. |
| 661 | -add_filter( | |
| 653 | +add_action( | |
| 662 | 654 | 'convertkit_admin_settings_register_sections', |
| 663 | 655 | function ( $sections ) { |
| 664 | 656 | |
| 665 | 657 | $sections['broadcasts'] = new ConvertKit_Admin_Section_Broadcasts(); |