| 1 |
<?php |
| 2 |
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure. |
| 3 |
namespace Yoast\WP\SEO\Schema_Aggregator\Application; |
| 4 |
|
| 5 |
use Yoast\WP\SEO\Helpers\Current_Page_Helper; |
| 6 |
use Yoast\WP\SEO\Introductions\Application\User_Allowed_Trait; |
| 7 |
use Yoast\WP\SEO\Introductions\Domain\Introduction_Interface; |
| 8 |
|
| 9 |
/** |
| 10 |
* Represents the introduction for the Schema aggregator feature announcement. |
| 11 |
*/ |
| 12 |
class Schema_Aggregator_Announcement implements Introduction_Interface { |
| 13 |
|
| 14 |
use User_Allowed_Trait; |
| 15 |
|
| 16 |
public const ID = 'schema-aggregator-announcement'; |
| 17 |
|
| 18 |
/** |
| 19 |
* Holds the current page helper. |
| 20 |
* |
| 21 |
* @var Current_Page_Helper |
| 22 |
*/ |
| 23 |
private $current_page_helper; |
| 24 |
|
| 25 |
/** |
| 26 |
* Constructs the introduction. |
| 27 |
* |
| 28 |
* @param Current_Page_Helper $current_page_helper The current page helper. |
| 29 |
*/ |
| 30 |
public function __construct( Current_Page_Helper $current_page_helper ) { |
| 31 |
$this->current_page_helper = $current_page_helper; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Returns the ID. |
| 36 |
* |
| 37 |
* @return string The ID. |
| 38 |
*/ |
| 39 |
public function get_id() { |
| 40 |
return self::ID; |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Returns the requested pagination priority. Lower means earlier. |
| 45 |
* |
| 46 |
* @return int The priority. |
| 47 |
*/ |
| 48 |
public function get_priority() { |
| 49 |
return 20; |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Returns whether this introduction should show. |
| 54 |
* |
| 55 |
* @return bool Whether this introduction should show. |
| 56 |
*/ |
| 57 |
public function should_show() { |
| 58 |
return $this->current_page_helper->is_yoast_seo_page() |
| 59 |
&& $this->is_user_allowed( [ 'wpseo_manage_options' ] ); |
| 60 |
} |
| 61 |
} |
| 62 |
|