Yoast\WP\SEO\Task_List\Application\Tasks

Complete_FTC{}Yoast 1.0└─ Abstract_Task

Represents the task for the completing the FTC.

Хуков нет.

Использование

$Complete_FTC = new Complete_FTC();
// use class methods

Методы

  1. public __construct( First_Time_Configuration_Notice_Helper $ftc_notice_helper )
  2. public get_call_to_action()
  3. public get_copy_set()
  4. public get_is_completed()
  5. public get_link()

Код Complete_FTC{} Yoast 27.7

class Complete_FTC extends Abstract_Task {

	/**
	 * Holds the id.
	 *
	 * @var string
	 */
	protected $id = 'complete-ftc';

	/**
	 * Holds the priority.
	 *
	 * @var string
	 */
	protected $priority = 'high';

	/**
	 * Holds the duration.
	 *
	 * @var int
	 */
	protected $duration = 15;

	/**
	 * Holds the first time configuration notice helper.
	 *
	 * @var First_Time_Configuration_Notice_Helper
	 */
	private $ftc_notice_helper;

	/**
	 * Constructs the task.
	 *
	 * @param First_Time_Configuration_Notice_Helper $ftc_notice_helper The first time configuration notice helper.
	 */
	public function __construct( First_Time_Configuration_Notice_Helper $ftc_notice_helper ) {
		$this->ftc_notice_helper = $ftc_notice_helper;
	}

	/**
	 * Returns whether this task is completed.
	 *
	 * @return bool Whether this task is completed.
	 */
	public function get_is_completed(): bool {
		return $this->ftc_notice_helper->is_first_time_configuration_finished( true );
	}

	/**
	 * Returns the task's link.
	 *
	 * @return string|null
	 */
	public function get_link(): ?string {
		return \self_admin_url( 'admin.php?page=wpseo_dashboard#/first-time-configuration' );
	}

	/**
	 * Returns the task's call to action entry.
	 *
	 * @return Call_To_Action_Entry|null
	 */
	public function get_call_to_action(): ?Call_To_Action_Entry {
		return new Call_To_Action_Entry(
			\__( 'Start configuration', 'wordpress-seo' ),
			'link',
			$this->get_link(),
		);
	}

	/**
	 * Returns the task's copy set.
	 *
	 * @return string|null
	 */
	public function get_copy_set(): Copy_Set {
		return new Copy_Set(
			\__( 'Complete the first time configuration', 'wordpress-seo' ),
			'<p>' . \sprintf(
				/* translators: %s expands to Yoast SEO */
				\__( 'Skipping setup limits how much %s can help you. Completing it makes sure the core settings are working in your favor.', 'wordpress-seo' ),
				'Yoast SEO',
			) . '</p>',
		);
	}
}