| 1 |
<?php |
| 2 |
|
| 3 |
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure. |
| 4 |
namespace Yoast\WP\SEO\Task_List\Application\Tasks; |
| 5 |
|
| 6 |
use Yoast\WP\SEO\Helpers\First_Time_Configuration_Notice_Helper; |
| 7 |
use Yoast\WP\SEO\Task_List\Domain\Components\Call_To_Action_Entry; |
| 8 |
use Yoast\WP\SEO\Task_List\Domain\Components\Copy_Set; |
| 9 |
use Yoast\WP\SEO\Task_List\Domain\Tasks\Abstract_Task; |
| 10 |
|
| 11 |
/** |
| 12 |
* Represents the task for the completing the FTC. |
| 13 |
*/ |
| 14 |
class Complete_FTC extends Abstract_Task { |
| 15 |
|
| 16 |
/** |
| 17 |
* Holds the id. |
| 18 |
* |
| 19 |
* @var string |
| 20 |
*/ |
| 21 |
protected $id = 'complete-ftc'; |
| 22 |
|
| 23 |
/** |
| 24 |
* Holds the priority. |
| 25 |
* |
| 26 |
* @var string |
| 27 |
*/ |
| 28 |
protected $priority = 'high'; |
| 29 |
|
| 30 |
/** |
| 31 |
* Holds the duration. |
| 32 |
* |
| 33 |
* @var int |
| 34 |
*/ |
| 35 |
protected $duration = 15; |
| 36 |
|
| 37 |
/** |
| 38 |
* Holds the first time configuration notice helper. |
| 39 |
* |
| 40 |
* @var First_Time_Configuration_Notice_Helper |
| 41 |
*/ |
| 42 |
private $ftc_notice_helper; |
| 43 |
|
| 44 |
/** |
| 45 |
* Constructs the task. |
| 46 |
* |
| 47 |
* @param First_Time_Configuration_Notice_Helper $ftc_notice_helper The first time configuration notice helper. |
| 48 |
*/ |
| 49 |
public function __construct( First_Time_Configuration_Notice_Helper $ftc_notice_helper ) { |
| 50 |
$this->ftc_notice_helper = $ftc_notice_helper; |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Returns whether this task is completed. |
| 55 |
* |
| 56 |
* @return bool Whether this task is completed. |
| 57 |
*/ |
| 58 |
public function get_is_completed(): bool { |
| 59 |
return $this->ftc_notice_helper->is_first_time_configuration_finished( true ); |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Returns the task's link. |
| 64 |
* |
| 65 |
* @return string|null |
| 66 |
*/ |
| 67 |
public function get_link(): ?string { |
| 68 |
return \self_admin_url( 'admin.php?page=wpseo_dashboard#/first-time-configuration' ); |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Returns the task's call to action entry. |
| 73 |
* |
| 74 |
* @return Call_To_Action_Entry|null |
| 75 |
*/ |
| 76 |
public function get_call_to_action(): ?Call_To_Action_Entry { |
| 77 |
return new Call_To_Action_Entry( |
| 78 |
\__( 'Start configuration', 'wordpress-seo' ), |
| 79 |
'link', |
| 80 |
$this->get_link(), |
| 81 |
); |
| 82 |
} |
| 83 |
|
| 84 |
/** |
| 85 |
* Returns the task's copy set. |
| 86 |
* |
| 87 |
* @return string|null |
| 88 |
*/ |
| 89 |
public function get_copy_set(): Copy_Set { |
| 90 |
return new Copy_Set( |
| 91 |
\__( 'Complete the first time configuration', 'wordpress-seo' ), |
| 92 |
'<p>' . \sprintf( |
| 93 |
/* translators: %s expands to Yoast SEO */ |
| 94 |
\__( 'Skipping setup limits how much %s can help you. Completing it makes sure the core settings are working in your favor.', 'wordpress-seo' ), |
| 95 |
'Yoast SEO', |
| 96 |
) . '</p>', |
| 97 |
); |
| 98 |
} |
| 99 |
} |
| 100 |
|