| 1 |
<?php |
| 2 |
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure. |
| 3 |
// phpcs:disable Yoast.NamingConventions.NamespaceName.MaxExceeded |
| 4 |
namespace Yoast\WP\SEO\Task_List\Application\Tasks\Child_Tasks; |
| 5 |
|
| 6 |
use Yoast\WP\SEO\Task_List\Domain\Components\Call_To_Action_Entry; |
| 7 |
use Yoast\WP\SEO\Task_List\Domain\Components\Score_Task_Analyzer; |
| 8 |
use Yoast\WP\SEO\Task_List\Domain\Components\Task_Analyzer_Interface; |
| 9 |
use Yoast\WP\SEO\Task_List\Domain\Tasks\Abstract_Child_Task; |
| 10 |
|
| 11 |
/** |
| 12 |
* Represents the child task for improving content SEO. |
| 13 |
*/ |
| 14 |
class Improve_Content_SEO_Child extends Abstract_Child_Task { |
| 15 |
|
| 16 |
use Content_Score_Child_Task_Trait; |
| 17 |
|
| 18 |
/** |
| 19 |
* Holds the duration. |
| 20 |
* |
| 21 |
* @var int |
| 22 |
*/ |
| 23 |
protected $duration = 10; |
| 24 |
|
| 25 |
/** |
| 26 |
* Returns the task's call to action entry. |
| 27 |
* |
| 28 |
* @return Call_To_Action_Entry|null |
| 29 |
*/ |
| 30 |
public function get_call_to_action(): ?Call_To_Action_Entry { |
| 31 |
$link = $this->get_link(); |
| 32 |
if ( $link !== null ) { |
| 33 |
$link = \add_query_arg( 'yoast-tab', 'seo', $link ); |
| 34 |
} |
| 35 |
|
| 36 |
return new Call_To_Action_Entry( |
| 37 |
\__( 'Improve SEO', 'wordpress-seo' ), |
| 38 |
'link', |
| 39 |
$link, |
| 40 |
); |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Returns the task's analyzer component. |
| 45 |
* |
| 46 |
* @return Task_Analyzer_Interface|null |
| 47 |
*/ |
| 48 |
public function get_analyzer(): ?Task_Analyzer_Interface { |
| 49 |
$result_labels = [ |
| 50 |
'good' => \__( 'Good', 'wordpress-seo' ), |
| 51 |
'ok' => \__( 'OK', 'wordpress-seo' ), |
| 52 |
'bad' => \__( 'Needs improvement', 'wordpress-seo' ), |
| 53 |
]; |
| 54 |
|
| 55 |
$result_descriptions = [ |
| 56 |
'good' => \__( 'Your content is well optimized for search engines. This increases your chances of ranking higher in search results.', 'wordpress-seo' ), |
| 57 |
'ok' => \__( 'Your content is partially optimized. Adding a few more SEO best practices will help you reach a wider audience.', 'wordpress-seo' ), |
| 58 |
'bad' => \__( 'Your content is not yet optimized for search. Follow the SEO recommendations to help search engines understand and rank your page.', 'wordpress-seo' ), |
| 59 |
]; |
| 60 |
|
| 61 |
$result = $this->content_item_score_data->get_score(); |
| 62 |
|
| 63 |
return new Score_Task_Analyzer( |
| 64 |
\__( 'SEO analysis', 'wordpress-seo' ), |
| 65 |
$result, |
| 66 |
$result_labels[ $result ], |
| 67 |
$result_descriptions[ $result ], |
| 68 |
); |
| 69 |
} |
| 70 |
} |
| 71 |
|