Initial commit: Atomaste website
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
namespace AIOSEO\Plugin\Lite\Admin;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use AIOSEO\Plugin\Common\Admin as CommonAdmin;
|
||||
|
||||
/**
|
||||
* Abstract class that Pro and Lite both extend.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class Admin extends CommonAdmin\Admin {
|
||||
/**
|
||||
* Connect class instance.
|
||||
*
|
||||
* @since 4.2.7
|
||||
*
|
||||
* @var Connect
|
||||
*/
|
||||
public $connect = null;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( ! wp_doing_cron() ) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
$this->connect = new Connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually adds the menu items to the admin bar.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function addAdminBarMenuItems() {
|
||||
// Add an upsell to Pro.
|
||||
if ( current_user_can( $this->getPageRequiredCapability( '' ) ) ) {
|
||||
$this->adminBarMenuItems['aioseo-pro-upgrade'] = [
|
||||
'parent' => 'aioseo-main',
|
||||
'title' => '<span class="aioseo-menu-highlight lite">' . __( 'Upgrade to Pro', 'all-in-one-seo-pack' ) . '</span>',
|
||||
'id' => 'aioseo-pro-upgrade',
|
||||
'href' => apply_filters(
|
||||
'aioseo_upgrade_link',
|
||||
esc_url( admin_url( 'admin.php?page=aioseo-tools&aioseo-redirect-upgrade=1' ) )
|
||||
),
|
||||
'meta' => [ 'target' => '_blank' ],
|
||||
];
|
||||
}
|
||||
|
||||
parent::addAdminBarMenuItems();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the menu inside of WordPress.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addMenu() {
|
||||
parent::addMenu();
|
||||
|
||||
$capability = $this->getPageRequiredCapability( '' );
|
||||
|
||||
// We use the global submenu, because we are adding an external link here.
|
||||
if ( current_user_can( $capability ) ) {
|
||||
global $submenu;
|
||||
$submenu[ $this->pageSlug ][] = [
|
||||
'<span class="aioseo-menu-highlight lite">' . esc_html__( 'Upgrade to Pro', 'all-in-one-seo-pack' ) . '</span>',
|
||||
$capability,
|
||||
apply_filters(
|
||||
'aioseo_upgrade_link',
|
||||
esc_url( admin_url( 'admin.php?page=aioseo-tools&aioseo-redirect-upgrade=1' ) )
|
||||
)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the query args to see if we need to redirect to an external URL.
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function checkForRedirects() {
|
||||
$mappedUrls = [
|
||||
// Added to resolve an issue with the open_basedir in the IIS.
|
||||
// https://github.com/awesomemotive/aioseo/issues/3243
|
||||
'aioseo-redirect-upgrade' => apply_filters(
|
||||
'aioseo_upgrade_link',
|
||||
aioseo()->helpers->utmUrl( AIOSEO_MARKETING_URL . 'lite-upgrade/', 'admin-bar', null, false )
|
||||
)
|
||||
];
|
||||
|
||||
foreach ( $mappedUrls as $queryArg => $redirectUrl ) {
|
||||
if ( isset( $_GET[ $queryArg ] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended
|
||||
wp_redirect( $redirectUrl );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,402 @@
|
||||
<?php
|
||||
namespace AIOSEO\Plugin\Lite\Admin;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use AIOSEO\Plugin\Common\Utils;
|
||||
|
||||
/**
|
||||
* Connect to AIOSEO Pro Worker Service to connect with our Premium Services.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class Connect {
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'wp_ajax_nopriv_aioseo_connect_process', [ $this, 'process' ] );
|
||||
|
||||
add_action( 'admin_menu', [ $this, 'addDashboardPage' ] );
|
||||
add_action( 'admin_init', [ $this, 'maybeLoadConnect' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a dashboard page for our setup wizard.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addDashboardPage() {
|
||||
add_dashboard_page( '', '', 'aioseo_manage_seo', 'aioseo-connect-pro', '' );
|
||||
remove_submenu_page( 'index.php', 'aioseo-connect-pro' );
|
||||
add_dashboard_page( '', '', 'aioseo_manage_seo', 'aioseo-connect', '' );
|
||||
remove_submenu_page( 'index.php', 'aioseo-connect' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if we should load the connect page.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function maybeLoadConnect() {
|
||||
// Don't load the interface if doing an AJAX call.
|
||||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for connect-specific parameter.
|
||||
// phpcs:disable HM.Security.ValidatedSanitizedInput.InputNotSanitized, HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended, Generic.Files.LineLength.MaxExceeded
|
||||
if ( ! isset( $_GET['page'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$page = sanitize_text_field( wp_unslash( $_GET['page'] ) );
|
||||
// phpcs:enable
|
||||
|
||||
// Check if we're on the right page and if current user is allowed to save settings.
|
||||
if (
|
||||
( 'aioseo-connect-pro' !== $page && 'aioseo-connect' !== $page ) ||
|
||||
! current_user_can( 'aioseo_manage_seo' )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
set_current_screen();
|
||||
|
||||
// Remove an action in the Gutenberg plugin ( not core Gutenberg ) which throws an error.
|
||||
remove_action( 'admin_print_styles', 'gutenberg_block_editor_admin_print_styles' );
|
||||
|
||||
if ( 'aioseo-connect-pro' === $page ) {
|
||||
$this->loadConnectPro();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->loadConnect();
|
||||
// phpcs:enable
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Connect template.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function loadConnect() {
|
||||
$this->enqueueScripts();
|
||||
$this->connectHeader();
|
||||
$this->connectContent();
|
||||
$this->connectFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Connect Pro template.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function loadConnectPro() {
|
||||
$this->enqueueScriptsPro();
|
||||
$this->connectHeader();
|
||||
$this->connectContent();
|
||||
$this->connectFooter( 'pro' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue's scripts for the setup wizard.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enqueueScripts() {
|
||||
// We don't want any plugin adding notices to our screens. Let's clear them out here.
|
||||
remove_all_actions( 'admin_notices' );
|
||||
remove_all_actions( 'network_admin_notices' );
|
||||
remove_all_actions( 'all_admin_notices' );
|
||||
|
||||
aioseo()->core->assets->load( 'src/vue/standalone/connect/main.js', [], aioseo()->helpers->getVueData() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue's scripts for the setup wizard.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enqueueScriptsPro() {
|
||||
// We don't want any plugin adding notices to our screens. Let's clear them out here.
|
||||
remove_all_actions( 'admin_notices' );
|
||||
remove_all_actions( 'network_admin_notices' );
|
||||
remove_all_actions( 'all_admin_notices' );
|
||||
|
||||
aioseo()->core->assets->load( 'src/vue/standalone/connect-pro/main.js', [], aioseo()->helpers->getVueData() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the simplified header used for the Onboarding Wizard.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function connectHeader() {
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width"/>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title>
|
||||
<?php
|
||||
// Translators: 1 - The plugin name ("All in One SEO").
|
||||
echo sprintf( esc_html__( '%1$s › Connect', 'all-in-one-seo-pack' ), esc_html( AIOSEO_PLUGIN_NAME ) );
|
||||
?>
|
||||
</title>
|
||||
</head>
|
||||
<body class="aioseo-connect">
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of the current step.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function connectContent() {
|
||||
echo '<div id="aioseo-app">';
|
||||
aioseo()->templates->getTemplate( 'admin/settings-page.php' );
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the simplified footer used for the Onboarding Wizard.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function connectFooter( $pro = '' ) {
|
||||
?>
|
||||
<?php
|
||||
wp_print_scripts( 'aioseo-vendors' );
|
||||
wp_print_scripts( 'aioseo-common' );
|
||||
wp_print_scripts( "aioseo-connect-$pro-script" );
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates and returns the AIOSEO Connect URL.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return array The AIOSEO Connect URL or an error message inside an array.
|
||||
*/
|
||||
public function generateConnectUrl( $key, $redirect = null ) {
|
||||
// Check for permissions.
|
||||
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||
return [
|
||||
'error' => esc_html__( 'You are not allowed to install plugins.', 'all-in-one-seo-pack' )
|
||||
];
|
||||
}
|
||||
|
||||
if ( empty( $key ) ) {
|
||||
return [
|
||||
'error' => esc_html__( 'Please enter your license key to connect.', 'all-in-one-seo-pack' ),
|
||||
];
|
||||
}
|
||||
|
||||
// Verify pro version is not installed.
|
||||
$active = activate_plugin( 'all-in-one-seo-pack-pro/all_in_one_seo_pack_pro', false, false, true );
|
||||
|
||||
if ( ! is_wp_error( $active ) ) {
|
||||
return [
|
||||
'error' => esc_html__( 'Pro version is already installed.', 'all-in-one-seo-pack' )
|
||||
];
|
||||
}
|
||||
|
||||
// Just check if network is set.
|
||||
$network = isset( $_POST['network'] ) ? (bool) sanitize_text_field( wp_unslash( $_POST['network'] ) ) : false; // phpcs:ignore HM.Security.ValidatedSanitizedInput.InputNotSanitized, HM.Security.NonceVerification.Missing, WordPress.Security.NonceVerification, Generic.Files.LineLength.MaxExceeded
|
||||
$network = ! empty( $network );
|
||||
|
||||
// Generate a hash that can be compared after the user is redirected back.
|
||||
$oth = hash( 'sha512', wp_rand() );
|
||||
$hashedOth = hash_hmac( 'sha512', $oth, wp_salt() );
|
||||
|
||||
// Save the options.
|
||||
aioseo()->internalOptions->internal->connect->key = $key;
|
||||
aioseo()->internalOptions->internal->connect->time = time();
|
||||
aioseo()->internalOptions->internal->connect->network = $network;
|
||||
aioseo()->internalOptions->internal->connect->token = $oth;
|
||||
|
||||
$url = add_query_arg( [
|
||||
'key' => $key,
|
||||
'network' => $network,
|
||||
'token' => $hashedOth,
|
||||
'version' => aioseo()->version,
|
||||
'siteurl' => admin_url(),
|
||||
'homeurl' => home_url(),
|
||||
'endpoint' => admin_url( 'admin-ajax.php' ),
|
||||
'php' => PHP_VERSION,
|
||||
'wp' => get_bloginfo( 'version' ),
|
||||
'redirect' => rawurldecode( base64_encode( $redirect ? $redirect : admin_url( 'admin.php?page=aioseo-settings' ) ) ),
|
||||
'v' => 1,
|
||||
], defined( 'AIOSEO_UPGRADE_URL' ) ? AIOSEO_UPGRADE_URL : 'https://upgrade.aioseo.com' );
|
||||
|
||||
// We're storing the ID of the user who is installing Pro so that we can add capabilties for him after upgrading.
|
||||
aioseo()->core->cache->update( 'connect_active_user', get_current_user_id(), 15 * MINUTE_IN_SECONDS );
|
||||
|
||||
return [
|
||||
'url' => $url,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Process AIOSEO Connect.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @return array An array containing a valid response or an error message.
|
||||
*/
|
||||
public function process() {
|
||||
// phpcs:disable HM.Security.NonceVerification.Missing, WordPress.Security.NonceVerification
|
||||
$hashedOth = ! empty( $_POST['token'] ) ? sanitize_text_field( wp_unslash( $_POST['token'] ) ) : '';
|
||||
$downloadUrl = ! empty( $_POST['file'] ) ? esc_url_raw( wp_unslash( $_POST['file'] ) ) : '';
|
||||
// phpcs:enable
|
||||
|
||||
$error = sprintf(
|
||||
// Translators: 1 - The marketing site domain ("aioseo.com").
|
||||
esc_html__( 'Could not install upgrade. Please download from %1$s and install manually.', 'all-in-one-seo-pack' ),
|
||||
esc_html( AIOSEO_MARKETING_DOMAIN )
|
||||
);
|
||||
|
||||
$success = esc_html__( 'Plugin installed & activated.', 'all-in-one-seo-pack' );
|
||||
|
||||
// Check if all required params are present.
|
||||
if ( empty( $downloadUrl ) || empty( $hashedOth ) ) {
|
||||
wp_send_json_error( $error );
|
||||
}
|
||||
|
||||
$oth = aioseo()->internalOptions->internal->connect->token;
|
||||
if ( empty( $oth ) ) {
|
||||
wp_send_json_error( $error );
|
||||
}
|
||||
|
||||
// Check if the stored hash matches the salted one that is sent back from the server.
|
||||
if ( hash_hmac( 'sha512', $oth, wp_salt() ) !== $hashedOth ) {
|
||||
wp_send_json_error( $error );
|
||||
}
|
||||
|
||||
// Delete connect token so we don't replay.
|
||||
aioseo()->internalOptions->internal->connect->token = null;
|
||||
|
||||
// Verify pro not activated.
|
||||
if ( aioseo()->pro ) {
|
||||
wp_send_json_success( $success );
|
||||
}
|
||||
|
||||
// Check license key.
|
||||
$licenseKey = aioseo()->internalOptions->internal->connect->key;
|
||||
if ( ! $licenseKey ) {
|
||||
wp_send_json_error( esc_html__( 'You are not licensed.', 'all-in-one-seo-pack' ) );
|
||||
}
|
||||
|
||||
// Set the license key in a new option so we can get it when Pro is activated.
|
||||
aioseo()->internalOptions->internal->validLicenseKey = $licenseKey;
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-screen.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/screen.php';
|
||||
|
||||
// Set the current screen to avoid undefined notices.
|
||||
set_current_screen( 'toplevel_page_aioseo' );
|
||||
|
||||
// Prepare variables.
|
||||
$url = esc_url_raw(
|
||||
add_query_arg(
|
||||
[
|
||||
'page' => 'aioseo-settings',
|
||||
],
|
||||
admin_url( 'admin.php' )
|
||||
)
|
||||
);
|
||||
|
||||
// Verify pro not installed.
|
||||
$network = aioseo()->internalOptions->internal->connect->network;
|
||||
$active = activate_plugin( 'all-in-one-seo-pack-pro/all_in_one_seo_pack.php', $url, $network, true );
|
||||
if ( ! is_wp_error( $active ) ) {
|
||||
aioseo()->internalOptions->internal->connect->reset();
|
||||
|
||||
// Because the regular activation hooks won't run, we need to add capabilities for the installing user so that he doesn't run into an error on the first request.
|
||||
aioseo()->activate->addCapabilitiesOnUpgrade();
|
||||
|
||||
wp_send_json_success( $success );
|
||||
}
|
||||
|
||||
$creds = request_filesystem_credentials( $url, '', false, false, null );
|
||||
// Check for file system permissions.
|
||||
if ( false === $creds ) {
|
||||
wp_send_json_error( $error );
|
||||
}
|
||||
|
||||
$fs = aioseo()->core->fs->noConflict();
|
||||
$fs->init( $creds );
|
||||
if ( ! $fs->isWpfsValid() ) {
|
||||
wp_send_json_error( $error );
|
||||
}
|
||||
|
||||
// Do not allow WordPress to search/download translations, as this will break JS output.
|
||||
remove_action( 'upgrader_process_complete', [ 'Language_Pack_Upgrader', 'async_upgrade' ], 20 );
|
||||
|
||||
// Create the plugin upgrader with our custom skin.
|
||||
$installer = new Utils\PluginUpgraderSilentAjax( new Utils\PluginUpgraderSkin() );
|
||||
|
||||
// Error check.
|
||||
if ( ! method_exists( $installer, 'install' ) ) {
|
||||
wp_send_json_error( $error );
|
||||
}
|
||||
|
||||
$installer->install( $downloadUrl );
|
||||
|
||||
// Flush the cache and return the newly installed plugin basename.
|
||||
wp_cache_flush();
|
||||
|
||||
$pluginBasename = $installer->plugin_info();
|
||||
|
||||
if ( ! $pluginBasename ) {
|
||||
wp_send_json_error( $error );
|
||||
}
|
||||
|
||||
// Activate the plugin silently.
|
||||
$activated = activate_plugin( $pluginBasename, '', $network, true );
|
||||
if ( is_wp_error( $activated ) ) {
|
||||
wp_send_json_error( esc_html__( 'The Pro version installed correctly, but it needs to be activated from the Plugins page inside your WordPress admin.', 'all-in-one-seo-pack' ) );
|
||||
}
|
||||
|
||||
aioseo()->internalOptions->internal->connect->reset();
|
||||
|
||||
// Because the regular activation hooks won't run, we need to add capabilities for the installing user so that he doesn't run into an error on the first request.
|
||||
aioseo()->activate->addCapabilitiesOnUpgrade();
|
||||
|
||||
wp_send_json_success( $success );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
namespace AIOSEO\Plugin\Lite\Admin\Notices;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use AIOSEO\Plugin\Common\Admin\Notices as CommonNotices;
|
||||
use AIOSEO\Plugin\Common\Models;
|
||||
|
||||
/**
|
||||
* Lite version of the notices class.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class Notices extends CommonNotices\Notices {
|
||||
/**
|
||||
* Initialize the internal notices.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function initInternalNotices() {
|
||||
parent::initInternalNotices();
|
||||
|
||||
$this->wooUpsellNotice();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the notification type.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @param string $type The notification type we are targeting.
|
||||
* @return boolean True if yes, false if no.
|
||||
*/
|
||||
public function validateType( $type ) {
|
||||
$validated = parent::validateType( $type );
|
||||
|
||||
// Any lite notification should pass here.
|
||||
if ( 'lite' === $type ) {
|
||||
$validated = true;
|
||||
}
|
||||
|
||||
return $validated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a notice if WooCommerce is detected and not licensed or running Lite.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function wooUpsellNotice() {
|
||||
$notification = Models\Notification::getNotificationByName( 'woo-upsell' );
|
||||
|
||||
if (
|
||||
! class_exists( 'WooCommerce' )
|
||||
) {
|
||||
if ( $notification->exists() ) {
|
||||
Models\Notification::deleteNotificationByName( 'woo-upsell' );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $notification->exists() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Models\Notification::addNotification( [
|
||||
'slug' => uniqid(),
|
||||
'notification_name' => 'woo-upsell',
|
||||
// Translators: 1 - "WooCommerce".
|
||||
'title' => sprintf( __( 'Advanced %1$s Support', 'all-in-one-seo-pack' ), 'WooCommerce' ),
|
||||
// Translators: 1 - "WooCommerce", 2 - The plugin short name ("AIOSEO").
|
||||
'content' => sprintf( __( 'We have detected you are running %1$s. Upgrade to %2$s to unlock our advanced eCommerce SEO features, including SEO for Product Categories and more.', 'all-in-one-seo-pack' ), 'WooCommerce', AIOSEO_PLUGIN_SHORT_NAME . ' Pro' ), // phpcs:ignore Generic.Files.LineLength.MaxExceeded
|
||||
'type' => 'info',
|
||||
'level' => [ 'all' ],
|
||||
// Translators: 1 - "Pro".
|
||||
'button1_label' => sprintf( __( 'Upgrade to %1$s', 'all-in-one-seo-pack' ), 'Pro' ),
|
||||
'button1_action' => html_entity_decode( apply_filters( 'aioseo_upgrade_link', aioseo()->helpers->utmUrl( AIOSEO_MARKETING_URL . 'lite-upgrade/', 'woo-notification-upsell', false ) ) ),
|
||||
'start' => gmdate( 'Y-m-d H:i:s' )
|
||||
] );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
namespace AIOSEO\Plugin\Lite\Admin;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use AIOSEO\Plugin\Common\Admin as CommonAdmin;
|
||||
|
||||
/**
|
||||
* Abstract class that Pro and Lite both extend.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class PostSettings extends CommonAdmin\PostSettings {
|
||||
/**
|
||||
* Holds a list of page builder integration class instances.
|
||||
* This prop exists for backwards compatibility with pre-4.2.0 versions (see backwardsCompatibilityLoad() in AIOSEO.php).
|
||||
*
|
||||
* @since 4.4.2
|
||||
*
|
||||
* @var object[]
|
||||
*/
|
||||
public $integrations = null;
|
||||
|
||||
/**
|
||||
* Initialize the admin.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add upsell to terms.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
if ( is_admin() ) {
|
||||
// We don't call getPublicTaxonomies() here because we want to show the CTA for Product Attributes as well.
|
||||
$taxonomies = get_taxonomies( [], 'objects' );
|
||||
foreach ( $taxonomies as $taxObject ) {
|
||||
if (
|
||||
empty( $taxObject->label ) ||
|
||||
! is_taxonomy_viewable( $taxObject )
|
||||
) {
|
||||
unset( $taxonomies[ $taxObject->name ] );
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $taxonomies as $taxonomy ) {
|
||||
add_action( $taxonomy->name . '_edit_form', [ $this, 'addTaxonomyUpsell' ] );
|
||||
add_action( 'after-' . $taxonomy->name . '-table', [ $this, 'addTaxonomyUpsell' ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Taxonomy Upsell
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addTaxonomyUpsell() {
|
||||
$screen = aioseo()->helpers->getCurrentScreen();
|
||||
if (
|
||||
! isset( $screen->parent_base ) ||
|
||||
'edit' !== $screen->parent_base ||
|
||||
empty( $screen->taxonomy )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
include_once AIOSEO_DIR . '/app/Lite/Views/taxonomy-upsell.php';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace AIOSEO\Plugin\Lite\Admin;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use AIOSEO\Plugin\Common\Admin as CommonAdmin;
|
||||
|
||||
/**
|
||||
* Usage tracking class.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class Usage extends CommonAdmin\Usage {
|
||||
/**
|
||||
* Class Constructor
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$this->enabled = aioseo()->options->advanced->usageTracking;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type for the request.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return string The install type.
|
||||
*/
|
||||
public function getType() {
|
||||
return 'lite';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user