| Server IP : 146.59.209.152 / Your IP : 216.73.216.46 Web Server : Apache System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : infrafs ( 43850) PHP Version : 8.2.29 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/infrafs/www/wp-content/plugins/wordpress-seo/src/integrations/admin/ |
Upload File : |
<?php
namespace Yoast\WP\SEO\Integrations\Admin;
use WPSEO_Admin_Asset_Manager;
use WPSEO_Shortlinker;
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
use Yoast\WP\SEO\Conditionals\Premium_Inactive_Conditional;
use Yoast\WP\SEO\Integrations\Integration_Interface;
/**
* WorkoutsIntegration class
*/
class Workouts_Integration implements Integration_Interface {
/**
* The admin asset manager.
*
* @var WPSEO_Admin_Asset_Manager
*/
private $admin_asset_manager;
/**
* The shortlinker.
*
* @var WPSEO_Shortlinker
*/
private $shortlinker;
/**
* {@inheritDoc}
*/
public static function get_conditionals() {
return [ Admin_Conditional::class, Premium_Inactive_Conditional::class ];
}
/**
* Workouts_Integration constructor.
*
* @param WPSEO_Admin_Asset_Manager $admin_asset_manager The admin asset manager.
* @param WPSEO_Shortlinker $shortlinker The shortlinker.
*/
public function __construct(
WPSEO_Admin_Asset_Manager $admin_asset_manager,
WPSEO_Shortlinker $shortlinker
) {
$this->admin_asset_manager = $admin_asset_manager;
$this->shortlinker = $shortlinker;
}
/**
* {@inheritDoc}
*/
public function register_hooks() {
\add_filter( 'wpseo_submenu_pages', [ $this, 'add_submenu_page' ], 8 );
\add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
}
/**
* Adds the workouts submenu page.
*
* @param array $submenu_pages The Yoast SEO submenu pages.
*
* @return array The filtered submenu pages.
*/
public function add_submenu_page( $submenu_pages ) {
// This inserts the workouts menu page at the correct place in the array without overriding that position.
$submenu_pages[] = [
'wpseo_dashboard',
'',
\__( 'Workouts', 'wordpress-seo' ) . ' <span class="yoast-badge yoast-premium-badge"></span>',
'edit_others_posts',
'wpseo_workouts',
[ $this, 'render' ],
];
return $submenu_pages;
}
/**
* Enqueue the workouts app.
*/
public function enqueue_assets() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Date is not processed or saved.
if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'wpseo_workouts' ) {
return;
}
$this->admin_asset_manager->enqueue_style( 'workouts' );
}
/**
* Renders the target for the React to mount to.
*/
public function render() {
$cornerstone_guide = $this->shortlinker->build_shortlink( 'https://yoa.st/4f1' );
$cornerstone_upsell = $this->shortlinker->build_shortlink( 'https://yoa.st/4f2' );
require_once \WPSEO_PATH . 'admin/views/workouts.php';
}
}