Commit realizado el 12:13:52 08-04-2024

This commit is contained in:
Pagina Web Monito
2024-04-08 12:13:55 -04:00
commit 0c33094de9
7815 changed files with 1365694 additions and 0 deletions

View File

@@ -0,0 +1,200 @@
<?php
/**
* The Compatibility wizard step.
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Wizard
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Wizard;
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
/**
* Step class.
*/
class Compatibility implements Wizard_Step {
/**
* Render step body.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function render( $wizard ) {
include_once $wizard->get_view( 'compatibility' );
}
/**
* Render form for step.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function form( $wizard ) {
$wizard->cmb->add_field(
[
'id' => 'setup_mode',
'name' => '',
'type' => 'radio',
'options' => [
/* translators: Option Description */
'easy' => '<div class="rank-math-mode-title">' . sprintf( __( 'Easy %s', 'rank-math' ), '</div><p>' . __( 'For websites where you only want to change the basics and let Rank Math do most of the heavy lifting. Most settings are set to default as per industry best practices. One just has to set it and forget it.', 'rank-math' ) . '</p>' ),
/* translators: Option Description */
'advanced' => '<div class="rank-math-mode-title">' . sprintf( __( 'Advanced %s', 'rank-math' ), '</div><p>' . __( 'For the advanced users who want to control every SEO aspect of the website. You are offered options to change everything and have full control over the websites SEO.', 'rank-math' ) . '</p>' ),
/* translators: Option Description */
'custom' => '<div class="rank-math-mode-title">' . sprintf( __( 'Custom Mode %s', 'rank-math' ), '</div><p class="rank-math-mode-description">' . __( 'Select this if you have a custom Rank Math settings file you want to use.', 'rank-math' ) . '</p>' ),
],
'default' => Helper::get_settings( 'general.setup_mode', 'advanced' ),
'classes' => ! defined( 'RANK_MATH_PRO_FILE' ) ? 'rank-math-setup-mode is-free' : 'rank-math-setup-mode',
'desc' => '<strong class="note">' . __( 'Note', 'rank-math' ) . '</strong>' . __( 'You can easily switch between modes at any point.', 'rank-math' ),
]
);
}
/**
* Save handler for step.
*
* @param array $values Values to save.
* @param object $wizard Wizard class instance.
*
* @return bool
*/
public function save( $values, $wizard ) {
$settings = wp_parse_args(
rank_math()->settings->all_raw(),
[ 'general' => '' ]
);
$settings['general']['setup_mode'] = ! empty( $values['setup_mode'] ) ? $values['setup_mode'] : 'easy';
if ( 'custom' === $settings['general']['setup_mode'] ) {
// Don't change, use custom imported value.
return true;
}
Helper::update_all_settings( $settings['general'], null, null );
return true;
}
/**
* Get conflicting plugins.
*
* @return array
*/
private function get_conflicting_plugins() {
$plugins_found = [];
$active_plugins = get_option( 'active_plugins' );
$conflicting_plugins = $this->get_conflicting_plugins_list();
foreach ( $conflicting_plugins as $plugin_slug => $plugin_name ) {
if ( in_array( $plugin_slug, $active_plugins, true ) !== false ) {
$plugins_found[ $plugin_slug ] = $plugin_name;
}
}
return $plugins_found;
}
/**
* Return list of conflicting plugins.
*
* @return array List of plugins in path => name format.
*/
private function get_conflicting_plugins_list() {
$plugins = [
'2-click-socialmedia-buttons/2-click-socialmedia-buttons.php' => '2 Click Social Media Buttons.',
'add-link-to-facebook/add-link-to-facebook.php' => 'Add Link to Facebook.',
'extended-wp-reset/extended-wp-reset.php' => 'Extended WP Reset.',
'add-meta-tags/add-meta-tags.php' => 'Add Meta Tags.',
'all-in-one-seo-pack/all_in_one_seo_pack.php' => 'All In One SEO Pack',
'easy-facebook-share-thumbnails/esft.php' => 'Easy Facebook Share Thumbnail.',
'facebook/facebook.php' => 'Facebook (official plugin).',
'facebook-awd/AWD_facebook.php' => 'Facebook AWD All in one.',
'facebook-featured-image-and-open-graph-meta-tags/fb-featured-image.php' => 'Facebook Featured Image & OG Meta Tags.',
'facebook-meta-tags/facebook-metatags.php' => 'Facebook Meta Tags.',
'wonderm00ns-simple-facebook-open-graph-tags/wonderm00n-open-graph.php' => 'Facebook Open Graph Meta Tags for WordPress.',
'facebook-revised-open-graph-meta-tag/index.php' => 'Facebook Revised Open Graph Meta Tag.',
'facebook-thumb-fixer/_facebook-thumb-fixer.php' => 'Facebook Thumb Fixer.',
'facebook-and-digg-thumbnail-generator/facebook-and-digg-thumbnail-generator.php' => 'Fedmich\'s Facebook Open Graph Meta.',
'network-publisher/networkpub.php' => 'Network Publisher.',
'nextgen-facebook/nextgen-facebook.php' => 'NextGEN Facebook OG.',
'opengraph/opengraph.php' => 'Open Graph.',
'open-graph-protocol-framework/open-graph-protocol-framework.php' => 'Open Graph Protocol Framework.',
'seo-facebook-comments/seofacebook.php' => 'SEO Facebook Comments.',
'seo-ultimate/seo-ultimate.php' => 'SEO Ultimate.',
'sexybookmarks/sexy-bookmarks.php' => 'Shareaholic.',
'shareaholic/sexy-bookmarks.php' => 'Shareaholic.',
'sharepress/sharepress.php' => 'SharePress.',
'simple-facebook-connect/sfc.php' => 'Simple Facebook Connect.',
'social-discussions/social-discussions.php' => 'Social Discussions.',
'social-sharing-toolkit/social_sharing_toolkit.php' => 'Social Sharing Toolkit.',
'socialize/socialize.php' => 'Socialize.',
'only-tweet-like-share-and-google-1/tweet-like-plusone.php' => 'Tweet, Like, Google +1 and Share.',
'wordbooker/wordbooker.php' => 'Wordbooker.',
'wordpress-seo/wp-seo.php' => 'Yoast SEO',
'wordpress-seo-premium/wp-seo-premium.php' => 'Yoast SEO Premium',
'wp-seopress/seopress.php' => 'SEOPress',
'wp-seopress-pro/seopress-pro.php' => 'SEOPress Pro',
'wpsso/wpsso.php' => 'WordPress Social Sharing Optimization.',
'wp-caregiver/wp-caregiver.php' => 'WP Caregiver.',
'wp-facebook-like-send-open-graph-meta/wp-facebook-like-send-open-graph-meta.php' => 'WP Facebook Like Send & Open Graph Meta.',
'wp-facebook-open-graph-protocol/wp-facebook-ogp.php' => 'WP Facebook Open Graph protocol.',
'wp-ogp/wp-ogp.php' => 'WP-OGP.',
'zoltonorg-social-plugin/zosp.php' => 'Zolton.org Social Plugin.',
'all-in-one-schemaorg-rich-snippets/index.php' => 'All In One Schema Rich Snippets.',
'wp-schema-pro/wp-schema-pro.php' => 'Schema Pro',
'no-category-base-wpml/no-category-base-wpml.php' => 'No Category Base (WPML)',
'all-404-redirect-to-homepage/all-404-redirect-to-homepage.php' => 'All 404 Redirect to Homepage',
'remove-category-url/remove-category-url.php' => 'Remove Category URL',
];
$plugins = Helper::is_module_active( 'redirections' ) ? array_merge( $plugins, $this->get_redirection_conflicting_plugins() ) : $plugins;
$plugins = Helper::is_module_active( 'sitemap' ) ? array_merge( $plugins, $this->get_sitemap_conflicting_plugins() ) : $plugins;
return $plugins;
}
/**
* Redirection: conflicting plugins.
*
* @return array
*/
private function get_redirection_conflicting_plugins() {
return [
'redirection/redirection.php' => 'Redirection',
];
}
/**
* Sitemap: conflicting plugins.
*
* @return array
*/
private function get_sitemap_conflicting_plugins() {
return [
'google-sitemap-plugin/google-sitemap-plugin.php' => 'Google Sitemap (BestWebSoft).',
'xml-sitemaps/xml-sitemaps.php' => 'XML Sitemaps (Denis de Bernardy and Mike Koepke).',
'bwp-google-xml-sitemaps/bwp-simple-gxs.php' => 'Better WordPress Google XML Sitemaps (Khang Minh).',
'google-sitemap-generator/sitemap.php' => 'Google XML Sitemaps (Arne Brachhold).',
'xml-sitemap-feed/xml-sitemap.php' => 'XML Sitemap & Google News feeds (RavanH).',
'google-monthly-xml-sitemap/monthly-xml-sitemap.php' => 'Google Monthly XML Sitemap (Andrea Pernici).',
'simple-google-sitemap-xml/simple-google-sitemap-xml.php' => 'Simple Google Sitemap XML (iTx Technologies).',
'another-simple-xml-sitemap/another-simple-xml-sitemap.php' => 'Another Simple XML Sitemap.',
'xml-maps/google-sitemap.php' => 'Xml Sitemap (Jason Martens).',
'google-xml-sitemap-generator-by-anton-dachauer/adachauer-google-xml-sitemap.php' => 'Google XML Sitemap Generator by Anton Dachauer (Anton Dachauer).',
'wp-xml-sitemap/wp-xml-sitemap.php' => 'WP XML Sitemap (Team Vivacity).',
'sitemap-generator-for-webmasters/sitemap.php' => 'Sitemap Generator for Webmasters (iwebslogtech).',
'xml-sitemap-xml-sitemapcouk/xmls.php' => 'XML Sitemap - XML-Sitemap.co.uk (Simon Hancox).',
'sewn-in-xml-sitemap/sewn-xml-sitemap.php' => 'Sewn In XML Sitemap (jcow).',
'rps-sitemap-generator/rps-sitemap-generator.php' => 'RPS Sitemap Generator (redpixelstudios).',
];
}
}

View File

@@ -0,0 +1,198 @@
<?php
/**
* The Import wizard step
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Wizard
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Wizard;
use RankMath\KB;
use RankMath\Admin\Importers\Detector;
defined( 'ABSPATH' ) || exit;
/**
* Step class.
*/
class Import implements Wizard_Step {
/**
* Render step body.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function render( $wizard ) {
?>
<header>
<h1><?php esc_html_e( 'Import SEO Settings', 'rank-math' ); ?></h1>
<p><?php esc_html_e( 'You can import SEO settings from the following plugins:', 'rank-math' ); ?></p>
</header>
<?php $wizard->cmb->show_form(); ?>
<div id="import-progress-bar">
<div id="importProgress">
<div id="importBar"></div>
</div>
<span class="left"><strong><?php echo esc_html__( 'Importing: ', 'rank-math' ); ?></strong><span class="plugin-from"></span> </span>
<span class="right"><span class="number">0</span>% <?php echo esc_html__( 'Completed', 'rank-math' ); ?></span>
</div>
<textarea id="import-progress" class="import-progress-area large-text" disabled="disabled" rows="8"></textarea>
<footer class="form-footer wp-core-ui rank-math-ui">
<button type="submit" class="button button-secondary button-deactivate-plugins" data-deactivate-message="<?php esc_html_e( 'Deactivating Plugins...', 'rank-math' ); ?>"><?php esc_html_e( 'Skip, Don\'t Import Now', 'rank-math' ); ?></button>
<button type="submit" class="button button-primary button-continue" style="display:none"><?php esc_html_e( 'Continue', 'rank-math' ); ?></button>
<button type="submit" class="button button-primary button-import"><?php esc_html_e( 'Start Import', 'rank-math' ); ?></button>
</footer>
<?php
}
/**
* Render form for step.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function form( $wizard ) {
$detector = new Detector();
$plugins = $detector->detect();
$plugins = $this->set_priority( $plugins );
$count = 0;
foreach ( $plugins as $slug => $plugin ) {
$checked = 'checked';
$multi_checked = 'multicheck-checked';
$choices = array_keys( $plugin['choices'] );
if ( isset( $plugin['checked'] ) && false === $plugin['checked'] ) {
$checked = '';
$multi_checked = '';
$choices = [];
}
$field_args = [
'id' => 'import_from_' . $slug,
'type' => 'group',
'description' => '<input type="checkbox" class="import-data" name="import[]" value="' . $slug . '" ' . $checked . ' data-plugin="' . $plugin['name'] . '" />',
'before_group' => 0 === $count ? '<h3 class="import-label">' . esc_html__( 'Input Data From:', 'rank-math' ) . '</h3>' : '',
'repeatable' => false,
'options' => [
'group_title' => $plugin['name'],
'sortable' => false,
'closed' => true,
],
];
$group_id = $wizard->cmb->add_field( $field_args );
$is_active = is_plugin_active( $plugin['file'] );
$wizard->cmb->add_group_field(
$group_id,
[
'id' => $slug . '_meta',
'type' => 'multicheck',
'repeatable' => false,
'desc' => $this->get_choice_description( $slug, $plugin, $is_active ),
'options' => $plugin['choices'],
'default' => $choices,
'dep' => [ [ 'import_from', $slug ] ],
'classes' => 'nob nopb cmb-multicheck-inline with-description ' . $multi_checked,
'attributes' => [ 'data-active' => $is_active ],
]
);
$count++;
// Add checkbox field to Recalculate SEO Scores.
// But not for Redirections.
if ( 'redirections' === $slug ) {
continue;
}
$wizard->cmb->add_group_field(
$group_id,
[
'id' => $slug . '_recalculate',
'type' => 'checkbox',
'repeatable' => false,
'desc' => esc_html__( 'Recalculate SEO Scores', 'rank-math' ),
'value' => 'recalculate',
'default' => 'recalculate',
'dep' => [ [ 'import_from', $slug ] ],
'classes' => 'nob nopb recalculate-scores',
'attributes' => [
'data-active' => $is_active,
'value' => 'recalculate',
],
]
);
}
}
/**
* Set plugins priority.
*
* @param array $plugins Array of detected plugins.
*
* @return array
*/
private function set_priority( $plugins ) {
$checked = false;
$priority = array_intersect( [ 'seopress', 'yoast', 'yoast-premium', 'aioseo' ], array_keys( $plugins ) );
foreach ( $priority as $slug ) {
if ( ! $checked ) {
$checked = true;
$plugins[ $slug ]['checked'] = true;
continue;
}
$plugins[ $slug ]['checked'] = false;
}
return $plugins;
}
/**
* Save handler for step.
*
* @param array $values Values to save.
* @param object $wizard Wizard class instance.
*
* @return bool
*/
public function save( $values, $wizard ) {
delete_option( 'rank_math_yoast_block_posts' );
return true;
}
/**
* Get description for choice field.
*
* @param string $slug Plugin slug.
* @param array $plugin Plugin info array.
* @param boolean $is_active Is plugin active.
*
* @return string
*/
private function get_choice_description( $slug, $plugin, $is_active ) {
/* translators: 1 is plugin name */
$desc = 'aio-rich-snippet' === $slug ? esc_html__( 'Import meta data from the %1$s plugin.', 'rank-math' ) : esc_html__( 'Import settings and meta data from the %1$s plugin.', 'rank-math' );
/* translators: 2 is link to Knowledge Base article */
$desc .= ' ' . __( 'The process may take a few minutes if you have a large number of posts or pages <a href="%2$s" target="_blank">Learn more about the import process here.</a>', 'rank-math' );
if ( $is_active ) {
/* translators: 1 is plugin name */
$desc .= '<br>' . __( ' %1$s plugin will be disabled automatically moving forward to avoid conflicts. <strong>It is thus recommended to import the data you need now.</strong>', 'rank-math' );
}
return sprintf( wp_kses_post( $desc ), $plugin['name'], KB::get( 'seo-import', 'SW Import Step' ) );
}
}

View File

@@ -0,0 +1,109 @@
<?php
/**
* The Monitor Redirection wizard step
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Wizard
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Wizard;
use RankMath\KB;
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
/**
* Step class.
*/
class Monitor_Redirection implements Wizard_Step {
/**
* Render step body.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function render( $wizard ) {
?>
<?php $wizard->cmb->show_form(); ?>
<footer class="form-footer wp-core-ui">
<?php $wizard->get_skip_link(); ?>
<button type="submit" class="button button-primary"><?php esc_html_e( 'Save and Continue', 'rank-math' ); ?></button>
</footer>
<?php
}
/**
* Render form for step.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function form( $wizard ) {
// 404 Monitor Title.
$wizard->cmb->add_field(
[
'id' => '404_monitor_title',
'type' => 'raw',
'content' => sprintf( '<div class="cmb-row monitor-header text-center"><h1>%1$s</h1><div class="monitor-desc text-center">%2$s</div>', esc_html__( '404 Monitor', 'rank-math' ), esc_html__( 'Set default values for the 404 error monitor here.', 'rank-math' ) . '</div>' ),
]
);
// 404 Monitor.
$wizard->cmb->add_field(
[
'id' => '404_monitor',
'type' => 'toggle',
'name' => esc_html__( '404 Monitor', 'rank-math' ),
/* translators: Link to kb article */
'desc' => __( 'The 404 monitor will let you see if visitors or search engines bump into any <code>404 Not Found</code> error while browsing your site.', 'rank-math' ),
'default' => Helper::is_module_active( '404-monitor' ) ? 'on' : 'off',
]
);
// Redirections.
$wizard->cmb->add_field(
[
'id' => 'redirection_title',
'type' => 'raw',
'content' => sprintf( '<br><div class="cmb-row redirections-header text-center" style="border-top:0;"><h1>%1$s</h1><div class="redirections-desc text-center">%2$s %3$s</div>', esc_html__( 'Redirections', 'rank-math' ), esc_html__( 'Set default values for the redirection module from here.', 'rank-math' ), '<a href="' . KB::get( 'redirections', 'SW Redirection Step' ) . '" target="_blank">' . esc_html__( 'Learn more about Redirections.', 'rank-math' ) . '</a></div>' ),
]
);
$wizard->cmb->add_field(
[
'id' => 'redirections',
'type' => 'toggle',
'name' => esc_html__( 'Redirections', 'rank-math' ),
'desc' => esc_html__( 'Set up temporary or permanent redirections. Combined with the 404 monitor, you can easily redirect faulty URLs on your site, or add custom redirections.', 'rank-math' ),
'default' => Helper::is_module_active( 'redirections' ) ? 'on' : 'off',
]
);
}
/**
* Save handler for step.
*
* @param array $values Values to save.
* @param object $wizard Wizard class instance.
*
* @return bool
*/
public function save( $values, $wizard ) {
Helper::update_modules(
[
'404-monitor' => $values['404_monitor'],
'redirections' => $values['redirections'],
]
);
return true;
}
}

View File

@@ -0,0 +1,118 @@
<?php
/**
* The Optimization wizard step
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Wizard
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Wizard;
use RankMath\KB;
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
/**
* Step class.
*/
class Optimization implements Wizard_Step {
/**
* Render step body.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function render( $wizard ) {
?>
<header>
<h1><?php esc_html_e( 'SEO Tweaks', 'rank-math' ); ?> </h1>
<p>
<?php
/* translators: Link to How to Optimization KB article */
printf( esc_html__( 'Automate some of your SEO tasks like making external links nofollow, redirecting attachment pages, etc. %s', 'rank-math' ), '<a href="' . esc_url( KB::get( 'seo-tweaks', 'SW Optimization Step' ) ) . '" target="_blank">' . esc_html__( 'Learn More', 'rank-math' ) . '</a>' );
?>
</p>
</header>
<?php $wizard->cmb->show_form(); ?>
<footer class="form-footer wp-core-ui rank-math-ui">
<?php $wizard->get_skip_link(); ?>
<button type="submit" class="button button-primary"><?php esc_html_e( 'Save and Continue', 'rank-math' ); ?></button>
</footer>
<?php
}
/**
* Render form for step.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function form( $wizard ) {
$wizard->cmb->add_field(
[
'id' => 'noindex_empty_taxonomies',
'type' => 'toggle',
'name' => esc_html__( 'Noindex Empty Category and Tag Archives', 'rank-math' ),
'desc' => wp_kses_post( __( 'Setting empty archives to <code>noindex</code> is useful for avoiding indexation of thin content pages and dilution of page rank. As soon as a post is added, the page is updated to <code>index</code>.', 'rank-math' ) ),
'default' => Helper::get_settings( 'titles.noindex_empty_taxonomies' ) ? 'on' : 'off',
'classes' => 'rank-math-advanced-option',
]
);
$wizard->cmb->add_field(
[
'id' => 'nofollow_external_links',
'type' => 'toggle',
'name' => esc_html__( 'Nofollow External Links', 'rank-math' ),
'desc' => wp_kses_post( __( 'Automatically add <code>rel="nofollow"</code> attribute for external links appearing in your posts, pages, and other post types. The attribute is dynamically applied when the content is displayed, and the stored content is not changed.', 'rank-math' ) ),
'default' => Helper::get_settings( 'general.nofollow_external_links' ) ? 'on' : 'off',
'classes' => 'rank-math-advanced-option',
]
);
$wizard->cmb->add_field(
[
'id' => 'new_window_external_links',
'type' => 'toggle',
'name' => esc_html__( 'Open External Links in New Tab/Window', 'rank-math' ),
'desc' => wp_kses_post( __( 'Automatically add a <code>target="_blank"</code> attribute to external links appearing in your posts, pages, and other post types. The attributes are applied when the content is displayed, which does not change the stored content.', 'rank-math' ) ),
'default' => Helper::get_settings( 'general.new_window_external_links' ) ? 'on' : 'off',
]
);
}
/**
* Save handler for step.
*
* @param array $values Values to save.
* @param object $wizard Wizard class instance.
*
* @return bool
*/
public function save( $values, $wizard ) {
$settings = rank_math()->settings->all_raw();
$settings['titles']['noindex_empty_taxonomies'] = $values['noindex_empty_taxonomies'];
if ( isset( $values['attachment_redirect_urls'] ) && 'on' === $values['attachment_redirect_urls'] ) {
$settings['general']['attachment_redirect_urls'] = $values['attachment_redirect_urls'];
$settings['general']['attachment_redirect_default'] = $values['attachment_redirect_default'];
}
$settings['general']['nofollow_external_links'] = isset( $values['nofollow_external_links'] ) ? $values['nofollow_external_links'] : 'off';
$settings['general']['new_window_external_links'] = $values['new_window_external_links'];
Helper::update_all_settings( $settings['general'], $settings['titles'], null );
Helper::schedule_flush_rewrite();
return true;
}
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* The Ready wizard step
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Wizard
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Wizard;
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
/**
* Step class.
*/
class Ready implements Wizard_Step {
/**
* Render step body.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function render( $wizard ) {
include_once $wizard->get_view( 'ready' );
}
/**
* Render form for step.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function form( $wizard ) {
Helper::is_configured( true );
}
/**
* Save handler for step.
*
* @param array $values Values to save.
* @param object $wizard Wizard class instance.
*
* @return bool
*/
public function save( $values, $wizard ) {
return true;
}
}

View File

@@ -0,0 +1,102 @@
<?php
/**
* The Role wizard step
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Wizard
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Wizard;
use RankMath\Helper;
use RankMath\Role_Manager\Capability_Manager;
defined( 'ABSPATH' ) || exit;
/**
* Step class.
*/
class Role implements Wizard_Step {
/**
* Render step body.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function render( $wizard ) {
?>
<header>
<h1><?php esc_html_e( 'Role Manager', 'rank-math' ); ?></h1>
<p><?php esc_html_e( 'Set capabilities here.', 'rank-math' ); ?></p>
</header>
<?php $wizard->cmb->show_form(); ?>
<footer class="form-footer wp-core-ui">
<?php $wizard->get_skip_link(); ?>
<button type="submit" class="button button-primary"><?php esc_html_e( 'Save and Continue', 'rank-math' ); ?></button>
</footer>
<?php
}
/**
* Render form for step.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function form( $wizard ) {
$wizard->cmb->add_field(
[
'id' => 'role_manager',
'type' => 'toggle',
'name' => esc_html__( 'Role Manager', 'rank-math' ),
/* translators: Link to kb article */
'desc' => __( 'The Role Manager allows you to use WordPress roles to control which of your site users can have edit or view access to Rank Math\'s settings.', 'rank-math' ),
'default' => Helper::is_module_active( 'role-manager' ) ? 'on' : 'off',
]
);
$defaults = Helper::get_roles_capabilities();
$caps = Capability_Manager::get()->get_capabilities();
$cap_count = count( $caps );
foreach ( Helper::get_roles() as $role => $label ) {
$default = isset( $defaults[ $role ] ) ? $defaults[ $role ] : [];
$wizard->cmb->add_field(
[
'id' => esc_attr( $role ),
'type' => 'multicheck_inline',
'name' => translate_user_role( $label ),
'options' => $caps,
'default' => $default,
'classes' => 'cmb-big-labels' . ( count( $default ) === $cap_count ? ' multicheck-checked' : '' ),
'dep' => [ [ 'role_manager', 'on' ] ],
]
);
}
}
/**
* Save handler for step.
*
* @param array $values Values to save.
* @param object $wizard Wizard class instance.
*
* @return bool
*/
public function save( $values, $wizard ) {
if ( empty( $values ) ) {
return false;
}
Helper::update_modules( [ 'role-manager' => $values['role_manager'] ] );
Helper::set_capabilities( $values );
return true;
}
}

View File

@@ -0,0 +1,191 @@
<?php
/**
* The Schema_Markup wizard step
*
* @since 1.0.32
* @package RankMath
* @subpackage RankMath\Wizard
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Wizard;
use RankMath\KB;
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
/**
* Step class.
*/
class Schema_Markup implements Wizard_Step {
/**
* Render step body.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function render( $wizard ) {
?>
<header>
<h1><?php esc_html_e( 'Schema Markup ', 'rank-math' ); ?> </h1>
<p><?php esc_html_e( 'Schema adds metadata to your website, resulting in rich search results and more traffic.', 'rank-math' ); ?></p>
</header>
<?php $wizard->cmb->show_form(); ?>
<footer class="form-footer wp-core-ui rank-math-ui">
<a href="<?php echo esc_url( Helper::get_admin_url() ); ?>" class="button button-secondary button-skip"><?php esc_html_e( 'Skip Step', 'rank-math' ); ?></a>
<button type="submit" class="button button-primary"><?php esc_html_e( 'Save and Continue', 'rank-math' ); ?></button>
</footer>
<?php
}
/**
* Render form for step.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function form( $wizard ) {
$wizard->cmb->add_field(
[
'id' => 'rich_snippet',
'type' => 'toggle',
'name' => esc_html__( 'Schema Type', 'rank-math' ),
'desc' => esc_html__( 'Use automatic structured data to mark up content, to help Google better understand your content\'s context for display in Search. You can set different defaults for your posts here.', 'rank-math' ),
'default' => Helper::is_module_active( 'rich-snippet' ) ? 'on' : 'off',
]
);
foreach ( Helper::get_accessible_post_types() as $post_type ) {
if ( 'attachment' === $post_type ) {
continue;
}
$wizard->cmb->add_field( $this->get_field_args( $post_type ) );
// Article fields.
$article_dep = [ 'relation' => 'and' ] + [ [ 'rich_snippet', 'on' ] ];
$article_dep[] = [ 'pt_' . $post_type . '_default_rich_snippet', 'article' ];
/* translators: Google article snippet doc link */
$article_desc = 'person' === Helper::get_settings( 'titles.knowledgegraph_type' ) ? '<div class="notice notice-warning inline rank-math-notice" style="margin-left:0;"><p>' . sprintf( __( 'Google does not allow Person as the Publisher for articles. Organization will be used instead. You can read more about this <a href="%s" target="_blank">here</a>.', 'rank-math' ), KB::get( 'google-article-schema' ) ) . '</p></div>' : '';
$wizard->cmb->add_field(
[
'id' => 'pt_' . $post_type . '_default_article_type',
'type' => 'radio_inline',
'name' => esc_html__( 'Article Type', 'rank-math' ),
'options' => [
'Article' => esc_html__( 'Article', 'rank-math' ),
'BlogPosting' => esc_html__( 'Blog Post', 'rank-math' ),
'NewsArticle' => esc_html__( 'News Article', 'rank-math' ),
],
'default' => Helper::get_settings( 'titles.pt_' . $post_type . '_default_article_type', 'post' === $post_type ? 'BlogPosting' : 'Article' ),
'dep' => $article_dep,
'desc' => $article_desc,
]
);
}
}
/**
* Save handler for step.
*
* @param array $values Values to save.
* @param object $wizard Wizard class instance.
*
* @return bool
*/
public function save( $values, $wizard ) {
$settings = rank_math()->settings->all_raw();
Helper::update_modules( [ 'rich-snippet' => $values['rich_snippet'] ] );
// Schema.
if ( 'on' === $values['rich_snippet'] ) {
$this->save_rich_snippet( $settings, $values );
}
Helper::update_all_settings( $settings['general'], $settings['titles'], null );
return Helper::get_admin_url();
}
/**
* Save rich snippet values for post type.
*
* @param array $settings Array of setting.
* @param array $values Values to save.
*/
private function save_rich_snippet( &$settings, $values ) {
foreach ( Helper::get_accessible_post_types() as $post_type ) {
if ( 'attachment' === $post_type ) {
continue;
}
$id = 'pt_' . $post_type . '_default_rich_snippet';
$article_type = 'pt_' . $post_type . '_default_article_type';
$settings['titles'][ $id ] = $values[ $id ];
$settings['titles'][ $article_type ] = $values[ $article_type ];
}
}
/**
* Get field arguments.
*
* @param string $post_type Post type.
*
* @return array
*/
private function get_field_args( $post_type ) {
$object = get_post_type_object( $post_type );
$field_id = 'pt_' . $post_type . '_default_rich_snippet';
/* translators: Post type name */
$field_name = sprintf( esc_html__( 'Schema Type for %s', 'rank-math' ), $object->label );
$richsnp_default = [
'post' => 'article',
'product' => 'product',
];
if ( 'product' === $post_type ) {
return [
'id' => $field_id,
'type' => 'radio_inline',
'name' => $field_name,
'desc' => __( 'Default rich snippet selected when creating a new product.', 'rank-math' ),
'options' => [
'off' => esc_html__( 'None', 'rank-math' ),
'product' => esc_html__( 'Product', 'rank-math' ),
],
'default' => Helper::get_settings( 'titles.pt_' . $post_type . '_default_rich_snippet', ( isset( $richsnp_default[ $post_type ] ) ? $richsnp_default[ $post_type ] : 'product' ) ),
];
}
$schema_types = Helper::choices_rich_snippet_types( esc_html__( 'None (Click here to set one)', 'rank-math' ), $post_type );
$type = 'select';
$attributes = [ 'data-s2' => '' ];
$default = isset( $richsnp_default[ $post_type ] ) ? $richsnp_default[ $post_type ] : 'off';
if ( 2 === count( $schema_types ) ) {
$type = 'radio_inline';
$attributes = '';
$default = array_key_last( $schema_types );
}
$default = Helper::get_settings( 'titles.pt_' . $post_type . '_default_rich_snippet', $default );
return [
'id' => $field_id,
'type' => $type,
'name' => $field_name,
'desc' => esc_html__( 'Default rich snippet selected when creating a new post of this type. ', 'rank-math' ),
'options' => $schema_types,
'dep' => [ [ 'rich_snippet', 'on' ] ],
'default' => $default ? $default : 'off',
'attributes' => $attributes,
];
}
}

View File

@@ -0,0 +1,110 @@
<?php
/**
* The Search Console wizard step
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Wizard
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Wizard;
use RankMath\KB;
use RankMath\Helper;
use RankMath\Helpers\Param;
defined( 'ABSPATH' ) || exit;
/**
* Step class.
*/
class Search_Console implements Wizard_Step {
/**
* Render step body.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function render( $wizard ) {
?>
<header>
<h1><?php esc_html_e( 'Connect Google&trade; Services', 'rank-math' ); ?> </h1>
<p>
<?php
/* translators: Link to How to Setup Google Search Console KB article */
printf( esc_html__( 'Rank Math automates everything, use below button to connect your site with Google Search Console and Google Analytics. It will verify your site and submit sitemaps automatically. %s', 'rank-math' ), '<a href="' . esc_url( KB::get( 'help-analytics', 'SW Analytics Step Description' ) ) . '" target="_blank">' . esc_html__( 'Read more about it here.', 'rank-math' ) . '</a>' );
?>
</p>
</header>
<?php $wizard->cmb->show_form(); ?>
<footer class="form-footer wp-core-ui rank-math-ui">
<?php $wizard->get_skip_link(); ?>
<button type="submit" class="button button-primary"><?php esc_html_e( 'Save and Continue', 'rank-math' ); ?></button>
</footer>
<?php
}
/**
* Render form for step.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function form( $wizard ) {
$wizard->cmb->add_field(
[
'id' => 'search_console_ui',
'type' => 'raw',
'file' => __DIR__ . '/views/search-console-ui.php',
]
);
}
/**
* Save handler for step.
*
* @param array $values Values to save.
* @param object $wizard Wizard class instance.
*
* @return bool
*/
public function save( $values, $wizard ) {
$settings = rank_math()->settings->all_raw();
$settings['general']['console_email_reports'] = Param::post( 'console_email_reports' );
Helper::update_all_settings( $settings['general'], null, null );
// For Search console.
$value = [
'country' => Param::post( 'site-console-country' ),
'profile' => Param::post( 'site-console-profile' ),
'enable_index_status' => Param::post( 'enable-index-status' ),
];
update_option( 'rank_math_google_analytic_profile', $value );
// For Analytics.
$analytic_value = [
'adsense_id' => Param::post( 'site-adsense-account' ),
'account_id' => Param::post( 'site-analytics-account' ),
'property_id' => Param::post( 'site-analytics-property' ),
'view_id' => Param::post( 'site-analytics-view' ),
'measurement_id' => Param::post( 'measurementID' ),
'stream_name' => Param::post( 'streamName' ),
'country' => Param::post( 'site-analytics-country' ),
'install_code' => 'on' === Param::post( 'install-code' ) ? true : false,
'anonymize_ip' => 'on' === Param::post( 'anonymize-ip' ) ? true : false,
'local_ga_js' => 'on' === Param::post( 'local-ga-js' ) ? true : false,
'exclude_loggedin' => 'on' === Param::post( 'exclude-loggedin' ) ? true : false,
];
update_option( 'rank_math_google_analytic_options', $analytic_value );
return true;
}
}

View File

@@ -0,0 +1,222 @@
<?php
/**
* The Sitemap wizard step
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Wizard
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Wizard;
use RankMath\KB;
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
/**
* Step class.
*/
class Sitemap implements Wizard_Step {
/**
* Render step body.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function render( $wizard ) {
?>
<header>
<h1><?php esc_html_e( 'Sitemap', 'rank-math' ); ?> </h1>
<p>
<?php
/* translators: Link to How to Setup Sitemap KB article */
printf( esc_html__( 'Choose your Sitemap configuration and select which type of posts or pages you want to include in your Sitemaps. %s', 'rank-math' ), '<a href="' . KB::get( 'configure-sitemaps', 'SW Sitemap Step' ) . '" target="_blank">' . esc_html__( 'Learn more.', 'rank-math' ) . '</a>' );
?>
</p>
</header>
<?php $wizard->cmb->show_form(); ?>
<footer class="form-footer wp-core-ui rank-math-ui">
<?php $wizard->get_skip_link(); ?>
<button type="submit" class="button button-primary"><?php esc_html_e( 'Save and Continue', 'rank-math' ); ?></button>
</footer>
<?php
}
/**
* Render form for step.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function form( $wizard ) {
$wizard->cmb->add_field(
[
'id' => 'sitemap',
'type' => 'toggle',
'name' => esc_html__( 'Sitemaps', 'rank-math' ),
'desc' => esc_html__( 'XML Sitemaps help search engines index your website&#039;s content more effectively.', 'rank-math' ),
'default' => Helper::is_module_active( 'sitemap' ) ? 'on' : 'off',
]
);
$wizard->cmb->add_field(
[
'id' => 'include_images',
'type' => 'toggle',
'name' => esc_html__( 'Include Images', 'rank-math' ),
'desc' => esc_html__( 'Include reference to images from the post content in sitemaps. This helps search engines index your images better.', 'rank-math' ),
'default' => Helper::get_settings( 'sitemap.include_images' ) ? 'on' : 'off',
'classes' => 'features-child',
'dep' => [ [ 'sitemap', 'on' ] ],
]
);
// Post Types.
$post_types = $this->get_post_types();
$wizard->cmb->add_field(
[
'id' => 'sitemap_post_types',
'type' => 'multicheck',
'name' => esc_html__( 'Public Post Types', 'rank-math' ),
'desc' => esc_html__( 'Select post types to enable SEO options for them and include them in the sitemap.', 'rank-math' ),
'options' => $post_types['post_types'],
'default' => $post_types['defaults'],
'classes' => 'features-child cmb-multicheck-inline' . ( count( $post_types['post_types'] ) === count( $post_types['defaults'] ) ? ' multicheck-checked' : '' ),
'dep' => [ [ 'sitemap', 'on' ] ],
]
);
// Taxonomies.
$taxonomies = $this->get_taxonomies();
$wizard->cmb->add_field(
[
'id' => 'sitemap_taxonomies',
'type' => 'multicheck',
'name' => esc_html__( 'Public Taxonomies', 'rank-math' ),
'desc' => esc_html__( 'Select taxonomies to enable SEO options for them and include them in the sitemap.', 'rank-math' ),
'options' => $taxonomies['taxonomies'],
'default' => $taxonomies['defaults'],
'classes' => 'features-child cmb-multicheck-inline' . ( count( $taxonomies['taxonomies'] ) === count( $taxonomies['defaults'] ) ? ' multicheck-checked' : '' ),
'dep' => [ [ 'sitemap', 'on' ] ],
]
);
}
/**
* Save handler for step.
*
* @param array $values Values to save.
* @param object $wizard Wizard class instance.
*
* @return bool
*/
public function save( $values, $wizard ) {
$settings = rank_math()->settings->all_raw();
Helper::update_modules( [ 'sitemap' => $values['sitemap'] ] );
if ( 'on' === $values['sitemap'] ) {
$settings['sitemap']['include_images'] = $values['include_images'];
$settings = $this->save_post_types( $settings, $values );
$settings = $this->save_taxonomies( $settings, $values );
Helper::update_all_settings( null, null, $settings['sitemap'] );
}
Helper::schedule_flush_rewrite();
return true;
}
/**
* Get post type data.
*
* @return array
*/
private function get_post_types() {
$p_defaults = [];
$post_types = Helper::choices_post_types();
unset( $post_types['attachment'] );
foreach ( $post_types as $post_type => $object ) {
if ( true === Helper::get_settings( "sitemap.pt_{$post_type}_sitemap" ) ) {
$p_defaults[] = $post_type;
}
}
return [
'defaults' => $p_defaults,
'post_types' => $post_types,
];
}
/**
* Get taxonomies data.
*
* @return array
*/
private function get_taxonomies() {
$t_defaults = [];
$taxonomies = Helper::get_accessible_taxonomies();
unset( $taxonomies['post_tag'], $taxonomies['post_format'], $taxonomies['product_tag'] );
$taxonomies = wp_list_pluck( $taxonomies, 'label', 'name' );
foreach ( $taxonomies as $taxonomy => $label ) {
if ( true === Helper::get_settings( "sitemap.tax_{$taxonomy}_sitemap" ) ) {
$t_defaults[] = $taxonomy;
}
}
return [
'defaults' => $t_defaults,
'taxonomies' => $taxonomies,
];
}
/**
* Save Post Types
*
* @param array $settings Array of all settings.
* @param array $values Array of posted values.
*
* @return array
*/
private function save_post_types( $settings, $values ) {
$post_types = Helper::choices_post_types();
if ( ! isset( $values['sitemap_post_types'] ) ) {
$values['sitemap_post_types'] = [];
}
foreach ( $post_types as $post_type => $object ) {
$settings['sitemap'][ "pt_{$post_type}_sitemap" ] = in_array( $post_type, $values['sitemap_post_types'], true ) ? 'on' : 'off';
}
return $settings;
}
/**
* Save Taxonomies
*
* @param array $settings Array of all settings.
* @param array $values Array of posted values.
*
* @return array
*/
private function save_taxonomies( $settings, $values ) {
$taxonomies = Helper::get_accessible_taxonomies();
$taxonomies = wp_list_pluck( $taxonomies, 'label', 'name' );
if ( ! isset( $values['sitemap_taxonomies'] ) ) {
$values['sitemap_taxonomies'] = [];
}
foreach ( $taxonomies as $taxonomy => $label ) {
$settings['sitemap'][ "tax_{$taxonomy}_sitemap" ] = in_array( $taxonomy, $values['sitemap_taxonomies'], true ) ? 'on' : 'off';
}
return $settings;
}
}

View File

@@ -0,0 +1,350 @@
<?php
/**
* The Your Site wizard step
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Wizard
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Wizard;
use RankMath\KB;
use RankMath\Helper;
use RankMath\Admin\Admin_Helper;
defined( 'ABSPATH' ) || exit;
/**
* Step class.
*/
class Your_Site implements Wizard_Step {
/**
* Render step body.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function render( $wizard ) {
include_once $wizard->get_view( 'your-site' );
}
/**
* Render form for step.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function form( $wizard ) {
$displayname = $this->get_site_display_name();
$wizard->cmb->add_field(
[
'id' => 'site_type',
'type' => 'select',
/* translators: sitename */
'name' => sprintf( esc_html__( '%1$s is a&hellip;', 'rank-math' ), $displayname ),
'options' => $this->get_type_choices(),
'default' => $this->get_default_site_type(),
]
);
$wizard->cmb->add_field(
[
'id' => 'business_type',
'type' => 'select',
'name' => esc_html__( 'Business Type', 'rank-math' ),
'desc' => esc_html__( 'Select the type that best describes your business. If you can\'t find one that applies exactly, use the generic "Organization" or "Local Business" types.', 'rank-math' ),
'options' => Helper::choices_business_types(),
'attributes' => [
'data-s2' => '',
'data-default' => Helper::get_settings( 'titles.local_business_type' ) ? '0' : '1',
],
'default' => Helper::get_settings( 'titles.local_business_type' ),
'dep' => $this->get_type_dependency(),
]
);
$wizard->cmb->add_field(
[
'id' => 'website_name',
'type' => 'text',
'name' => esc_html__( 'Website Name', 'rank-math' ),
'default' => Helper::get_settings( 'titles.website_name', $displayname ),
'desc' => esc_html__( 'Enter the name of your site to appear in search results.', 'rank-math' ),
]
);
$wizard->cmb->add_field(
[
'id' => 'website_alternate_name',
'type' => 'text',
'default' => Helper::get_settings( 'titles.website_alternate_name' ),
'name' => esc_html__( 'Website Alternate Name', 'rank-math' ),
'desc' => esc_html__( 'An alternate version of your site name (for example, an acronym or shorter name).', 'rank-math' ),
]
);
$wizard->cmb->add_field(
[
'id' => 'company_name',
'type' => 'text',
'name' => esc_html__( 'Person/Organization Name', 'rank-math' ),
'desc' => esc_html__( 'Your name or company name intended to feature in Google\'s Knowledge Panel.', 'rank-math' ),
'default' => Helper::get_settings( 'titles.knowledgegraph_name', $displayname ),
]
);
$wizard->cmb->add_field(
[
'id' => 'company_logo',
'type' => 'file',
'name' => esc_html__( 'Logo for Google', 'rank-math' ),
'default' => $this->get_default_logo(),
'desc' => __( '<strong>Min Size: 112Χ112px</strong>.<br />A squared image is preferred by the search engines.', 'rank-math' ),
'options' => [ 'url' => false ],
]
);
$wizard->cmb->add_field(
[
'id' => 'open_graph_image',
'type' => 'file',
'name' => esc_html__( 'Default Social Share Image', 'rank-math' ),
'desc' => __( 'When a featured image or an OpenGraph Image is not set for individual posts/pages/CPTs, this image will be used as a fallback thumbnail when your post is shared on Facebook. <strong>The recommended image size is 1200 x 630 pixels.</strong>', 'rank-math' ),
'options' => [ 'url' => false ],
'default' => Helper::get_settings( 'titles.open_graph_image' ),
]
);
}
/**
* Save handler for step.
*
* @param array $values Values to save.
* @param object $wizard Wizard class instance.
*
* @return bool
*/
public function save( $values, $wizard ) {
$settings = wp_parse_args(
rank_math()->settings->all_raw(),
[
'titles' => '',
'sitemap' => '',
]
);
$values = wp_parse_args(
$values,
[
'company_name' => '',
'company_logo' => '',
'company_logo_id' => '',
'open_graph_image' => '',
'open_graph_image_id' => '',
]
);
// Save these settings.
$functions = [ 'save_local_seo', 'save_open_graph', 'save_post_types', 'save_taxonomies' ];
foreach ( $functions as $function ) {
$settings = $this->$function( $settings, $values );
}
$business_type = [ 'news', 'business', 'webshop', 'otherbusiness' ];
$modules = [ 'local-seo' => in_array( $values['site_type'], $business_type, true ) ? 'on' : 'off' ];
$users = get_users( [ 'role__in' => [ 'administrator', 'editor', 'author', 'contributor' ] ] );
if ( count( $users ) > 1 && ! is_plugin_active( 'members/members.php' ) ) {
$modules['role-manager'] = 'on';
}
set_transient( '_rank_math_site_type', $values['site_type'] );
Helper::update_modules( $modules );
Helper::update_all_settings( null, $settings['titles'], null );
return true;
}
/**
* Save Local Seo
*
* @param array $settings Array of all settings.
* @param array $values Array of posted values.
*
* @return array
*/
private function save_local_seo( $settings, $values ) {
switch ( $values['site_type'] ) {
case 'blog':
case 'portfolio':
$settings['titles']['knowledgegraph_type'] = 'person';
$settings['titles']['knowledgegraph_name'] = $values['company_name'];
$settings['titles']['knowledgegraph_logo'] = $values['company_logo'];
$settings['titles']['knowledgegraph_logo_id'] = $values['company_logo_id'];
break;
case 'news':
case 'webshop':
case 'business':
case 'otherbusiness':
$settings['titles']['knowledgegraph_type'] = 'company';
$settings['titles']['knowledgegraph_name'] = $values['company_name'];
$settings['titles']['knowledgegraph_logo'] = $values['company_logo'];
$settings['titles']['local_business_type'] = $values['business_type'];
$settings['titles']['knowledgegraph_logo_id'] = $values['company_logo_id'];
break;
case 'otherpersonal':
$settings['titles']['knowledgegraph_type'] = 'person';
$settings['titles']['knowledgegraph_name'] = $values['company_name'];
break;
}
foreach ( [ 'website_name', 'website_alternate_name' ] as $key ) {
if ( empty( $values[ $key ] ) ) {
continue;
}
$settings['titles'][ $key ] = $values[ $key ];
}
return $settings;
}
/**
* Save Open Graph
*
* @param array $settings Array of all settings.
* @param array $values Array of posted values.
*
* @return array
*/
private function save_open_graph( $settings, $values ) {
if ( ! empty( $values['open_graph_image_id'] ) ) {
$settings['titles']['open_graph_image'] = $values['open_graph_image'];
$settings['titles']['open_graph_image_id'] = $values['open_graph_image_id'];
}
if ( empty( $values['company_logo_id'] ) ) {
unset( $settings['titles']['knowledgegraph_logo'] );
unset( $settings['titles']['knowledgegraph_logo_id'] );
}
return $settings;
}
/**
* Save Post Types
*
* @param array $settings Array of all settings.
* @param array $values Array of posted values.
*
* @return array
*/
private function save_post_types( $settings, $values ) {
foreach ( Helper::get_accessible_post_types() as $post_type => $label ) {
if ( 'attachment' === $post_type ) {
continue;
}
$settings['titles'][ "pt_{$post_type}_add_meta_box" ] = 'on';
}
return $settings;
}
/**
* Save Taxonomies
*
* @param array $settings Array of all settings.
* @param array $values Array of posted values.
*
* @return array
*/
private function save_taxonomies( $settings, $values ) {
$taxonomies = Admin_Helper::get_taxonomies_options();
array_shift( $taxonomies );
foreach ( $taxonomies as $taxonomy => $label ) {
$settings['titles'][ "tax_{$taxonomy}_add_meta_box" ] = 'on';
}
return $settings;
}
/**
* Get site display name.
*
* @return string
*/
protected function get_site_display_name() {
$siteurl = get_bloginfo( 'url' );
$sitename = get_bloginfo( 'title' );
return $sitename ? $sitename : $siteurl;
}
/**
* Get default logo.
*
* @return string
*/
private function get_default_logo() {
if ( defined( 'MTS_THEME_NAME' ) && MTS_THEME_NAME ) {
$theme_options = get_option( MTS_THEME_NAME );
if ( isset( $theme_options['mts_logo'] ) ) {
return wp_get_attachment_url( $theme_options['mts_logo'] );
}
}
if ( current_theme_supports( 'custom-logo' ) && ! empty( get_theme_mod( 'custom_logo' ) ) ) {
return wp_get_attachment_url( get_theme_mod( 'custom_logo' ) );
}
return Helper::get_settings( 'titles.knowledgegraph_logo' );
}
/**
* Get default site type.
*
* @return string
*/
private function get_default_site_type() {
$default_type = get_transient( '_rank_math_site_type' );
return $default_type ? $default_type : ( class_exists( 'Easy_Digital_Downloads' ) || class_exists( 'WooCommerce' ) ? 'webshop' : 'blog' );
}
/**
* Get type dependecy.
*
* @return array
*/
private function get_type_dependency() {
return [
[ 'site_type', 'news' ],
[ 'site_type', 'business' ],
[ 'site_type', 'webshop' ],
[ 'site_type', 'otherbusiness' ],
];
}
/**
* Get type choices.
*
* @return array
*/
private function get_type_choices() {
return [
'blog' => esc_html__( 'Personal Blog', 'rank-math' ),
'news' => esc_html__( 'Community Blog/News Site', 'rank-math' ),
'portfolio' => esc_html__( 'Personal Portfolio', 'rank-math' ),
'business' => esc_html__( 'Small Business Site', 'rank-math' ),
'webshop' => esc_html__( 'Webshop', 'rank-math' ),
'otherpersonal' => esc_html__( 'Other Personal Website', 'rank-math' ),
'otherbusiness' => esc_html__( 'Other Business Website', 'rank-math' ),
];
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
* The wizard step contract.
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Wizard
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Wizard;
defined( 'ABSPATH' ) || exit;
/**
* Wizard step contract.
*/
interface Wizard_Step {
/**
* Render step body.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function render( $wizard );
/**
* Render form for step.
*
* @param object $wizard Wizard class instance.
*
* @return void
*/
public function form( $wizard );
/**
* Save handler for step.
*
* @param array $values Values to save.
* @param object $wizard Wizard class instance.
*
* @return bool
*/
public function save( $values, $wizard );
}

View File

@@ -0,0 +1,178 @@
<?php
/**
* Setup wizard compatibility step.
*
* @package RankMath
* @subpackage RankMath\Admin\Wizard
*/
use RankMath\Helper;
use RankMath\KB;
defined( 'ABSPATH' ) || exit;
global $wp_version;
update_option( 'rank_math_wizard_completed', true );
$php_version = phpversion();
$php_version_ok = version_compare( $php_version, rank_math()->php_version, '>' );
$php_version_recommend = version_compare( $php_version, '7.4', '<' );
$dom_ext = extension_loaded( 'dom' );
$simplexml_ext = extension_loaded( 'SimpleXML' );
$image_ext = extension_loaded( 'gd' ) || extension_loaded( 'imagick' );
$mb_string = extension_loaded( 'mbstring' );
$openssl = extension_loaded( 'openssl' );
$base64_func = function_exists( 'base64_encode' ) && function_exists( 'base64_decode' ) && (bool) base64_decode( base64_encode( '1' ) );
$all_good = $php_version_ok && $dom_ext && $simplexml_ext && $image_ext && $mb_string && $openssl && $base64_func;
?>
<?php $wizard->cmb->show_form(); ?>
<?php
if ( $all_good ) :
?>
<br>
<h2 class="text-center compatibility-check">
<i class="dashicons <?php echo $php_version_recommend ? 'dashicons-warning' : 'dashicons-yes'; ?>"></i> <?php esc_html_e( 'Your website is compatible to run Rank Math SEO', 'rank-math' ); ?>
<a href="#" data-target="rank-math-compatibility-collapsible" class="rank-math-collapsible-trigger">
<span class="dashicons dashicons-arrow-down-alt2"><span><?php esc_html_e( 'More', 'rank-math' ); ?></span></span>
<span class="dashicons dashicons-arrow-up-alt2"><span><?php esc_html_e( 'Less', 'rank-math' ); ?></span></span>
</a>
</h2>
<div id="rank-math-compatibility-collapsible" class="rank-math-collapsible-content">
<?php endif; ?>
<table class="form-table">
<tr class="check-<?php echo $php_version_ok ? 'yes' : 'no'; ?>">
<th>
<?php
if ( $php_version_ok ) {
/* translators: php version */
printf( esc_html__( 'Your PHP Version: %s', 'rank-math' ), $php_version );
if ( $php_version_recommend ) {
?>
<?php echo ' | ' . esc_html__( 'Recommended: PHP 7.4 or later', 'rank-math' ); ?>
<p class="description">
<?php
echo ( ! Helper::is_whitelabel() ) ?
esc_html__( 'Rank Math is compatible with your PHP version but we recommend updating to PHP 7.4 for increased speed and security.', 'rank-math' ) . ' <a href="' . KB::get( 'requirements', 'Setup wizard compatibility step' ) . '" target="_blank">' . esc_html__( 'More information', 'rank-math' ) . '</a>' :
esc_html__( 'This plugin is compatible with your PHP version but we recommend updating to PHP 7.4 for increased speed and security.', 'rank-math' );
?>
</p>
<?php
}
} else {
/* translators: php version */
printf( esc_html__( 'Your PHP Version: %s | Recommended version: 7.4 | Minimal required: 7.2', 'rank-math' ), $php_version );
}
?>
</th>
<td><span class="dashicons dashicons-<?php echo $php_version_ok ? ( $php_version_recommend ? 'warning' : 'yes' ) : 'no'; ?>"></span></td>
</tr>
<tr class="check-yes">
<th>
<?php
echo esc_html__( 'You are using the recommended WordPress version.', 'rank-math' );
?>
</th>
<td><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr class="check-<?php echo $dom_ext ? 'yes' : 'no'; ?>">
<th>
<?php echo $dom_ext ? esc_html__( 'PHP DOM Extension installed', 'rank-math' ) : esc_html__( 'PHP DOM Extension missing', 'rank-math' ); ?>
</th>
<td><span class="dashicons dashicons-<?php echo $dom_ext ? 'yes' : 'no'; ?>"></span></td>
</tr>
<tr class="check-<?php echo $simplexml_ext ? 'yes' : 'no'; ?>">
<th>
<?php echo $simplexml_ext ? esc_html__( 'PHP SimpleXML Extension installed', 'rank-math' ) : esc_html__( 'PHP SimpleXML Extension missing', 'rank-math' ); ?>
</th>
<td><span class="dashicons dashicons-<?php echo $simplexml_ext ? 'yes' : 'no'; ?>"></span></td>
</tr>
<tr class="check-<?php echo $image_ext ? 'yes' : 'no'; ?>">
<th>
<?php echo $image_ext ? esc_html__( 'PHP GD or Imagick Extension installed', 'rank-math' ) : esc_html__( 'PHP GD or Imagick Extension missing', 'rank-math' ); ?>
</th>
<td><span class="dashicons dashicons-<?php echo $image_ext ? 'yes' : 'no'; ?>"></span></td>
</tr>
<tr class="check-<?php echo $mb_string ? 'yes' : 'no'; ?>">
<th>
<?php echo $mb_string ? esc_html__( 'PHP MBstring Extension installed', 'rank-math' ) : esc_html__( 'PHP MBstring Extension missing', 'rank-math' ); ?>
</th>
<td><span class="dashicons dashicons-<?php echo $mb_string ? 'yes' : 'no'; ?>"></span></td>
</tr>
<tr class="check-<?php echo $openssl ? 'yes' : 'no'; ?>">
<th>
<?php echo $openssl ? esc_html__( 'PHP OpenSSL Extension installed', 'rank-math' ) : esc_html__( 'PHP OpenSSL Extension missing', 'rank-math' ); ?>
</th>
<td><span class="dashicons dashicons-<?php echo $mb_string ? 'yes' : 'no'; ?>"></span></td>
</tr>
<tr class="check-<?php echo $base64_func ? 'yes' : 'no'; ?>">
<th>
<?php echo $base64_func ? esc_html__( 'Base64 encode &amp; decode functions available', 'rank-math' ) : esc_html__( 'Base64 encode &amp; decode functions missing', 'rank-math' ); ?>
</th>
<td><span class="dashicons dashicons-<?php echo $base64_func ? 'yes' : 'no'; ?>"></span></td>
</tr>
</table>
<?php if ( $all_good ) { ?>
<p class="description checklist-ok">
<?php
echo ( ! Helper::is_whitelabel() ) ?
esc_html__( 'Your server is correctly configured to use Rank Math.', 'rank-math' ) :
esc_html__( 'Your server is correctly configured to use this plugin.', 'rank-math' );
?>
</p>
<?php } else { ?>
<p class="description checklist-not-ok">
<?php
echo ( ! Helper::is_whitelabel() ) ?
esc_html__( 'Please resolve the issues above to be able to use all features of Rank Math plugin. If you are not sure how to do it, please contact your hosting provider.', 'rank-math' ) :
esc_html__( 'Please resolve the issues above to be able to use all SEO features. If you are not sure how to do it, please contact your hosting provider.', 'rank-math' );
?>
</p>
<?php } ?>
<?php
//
// PLUGINS.
//
$conflicting_plugins = $this->get_conflicting_plugins();
?>
<?php if ( $conflicting_plugins ) : ?>
<p class="conflict-text">
<?php
echo ( ! Helper::is_whitelabel() ) ?
esc_html__( 'The following active plugins on your site may cause conflict issues when used alongside Rank Math: ', 'rank-math' ) :
esc_html__( 'The following active plugins on your site may cause conflict issues when used alongside this plugin: ', 'rank-math' );
?>
</p>
<table class="form-table wp-core-ui wizard-conflicts">
<?php foreach ( $conflicting_plugins as $pk => $plugin ) { ?>
<tr>
<td><span class="dashicons dashicons-warning"></span></td>
<td><?php echo $plugin . ( in_array( $pk, [ 'all-in-one-schemaorg-rich-snippets/index.php', 'wordpress-seo/wp-seo.php', 'wordpress-seo-premium/wp-seo-premium.php', 'all-in-one-seo-pack/all_in_one_seo_pack.php' ], true ) ? '<span class="import-info">' . esc_html__( 'You can import settings in the next step.', 'rank-math' ) . '</span>' : '' ); ?></td>
<td><a href="#" class="button button-small wizard-deactivate-plugin" data-plugin="<?php echo esc_attr( $pk ); ?>"><?php esc_html_e( 'Deactivate Plugin', 'rank-math' ); ?></a></td>
</tr>
<?php } ?>
</table>
<?php
set_transient( '_rank_math_conflicting_plugins', array_keys( $conflicting_plugins ) );
else :
delete_transient( '_rank_math_conflicting_plugins' );
?>
<p class="conflict-text noconflict"><?php esc_html_e( 'No known conflicting plugins found.', 'rank-math' ); ?></p>
<?php endif; ?>
<?php if ( $all_good ) : ?>
</div> <!-- /collapsible -->
<?php endif; ?>
<footer class="form-footer rank-math-custom wp-core-ui rank-math-ui text-center">
<?php if ( $all_good ) : ?>
<button type="submit" class="button button-primary button-animated"><?php esc_html_e( 'Start Wizard', 'rank-math' ); ?> <i class="dashicons dashicons-arrow-right-alt2"></i></button>
<?php endif; ?>
</footer>

View File

@@ -0,0 +1,44 @@
<?php
/**
* Setup wizard content template.
*
* @package RankMath
* @subpackage RankMath\Admin\Wizard
*/
use RankMath\KB;
use RankMath\Helpers\Param;
defined( 'ABSPATH' ) || exit;
?>
<div class="header">
<div class="logo text-center">
<a href="<?php KB::the( 'logo', 'SW Logo' ); ?>" target="_blank"><img src="<?php echo esc_url( rank_math()->plugin_url() . 'assets/admin/img/logo.svg' ); ?>" width="245"></a>
</div>
<?php require_once $this->get_view( 'navigation' ); ?>
</div>
<div class="wrapper">
<div class="main-content wizard-content--<?php echo esc_attr( $this->step_slug ); ?>">
<form class="cmb-form" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="post">
<input type="hidden" name="action" value="<?php echo 'rank-math-registration' === $this->slug ? 'rank_math_save_registration' : 'rank_math_save_wizard'; ?>">
<input type="hidden" name="step" value="<?php echo esc_attr( $this->step ); ?>">
<?php wp_nonce_field( 'rank-math-wizard', 'security' ); ?>
<?php $this->body(); ?>
</form>
</div>
</div>
<?php
if ( ! in_array( $this->step_slug, [ 'register', 'ready' ], true ) ) :
echo sprintf( '<div class="return-to-dashboard"><a href="%s">%s</a></div>', esc_url( 'rank-math-registration' === Param::get( 'page' ) ? admin_url( '/' ) : RankMath\Helper::get_dashboard_url() ), esc_html__( 'Return to dashboard', 'rank-math' ) );
endif;
?>

View File

@@ -0,0 +1,22 @@
<?php
/**
* Setup wizard footer template.
*
* @package RankMath
* @subpackage RankMath\Admin\Wizard
*/
defined( 'ABSPATH' ) || exit;
echo '</body>' . "\n";
CMB2_JS::enqueue();
rank_math()->json->output();
if ( function_exists( 'wp_print_media_templates' ) ) {
wp_print_media_templates();
}
wp_print_footer_scripts();
wp_print_scripts( 'rank-math-wizard' );
wp_print_scripts( 'cmb2-scripts' );
echo '</html>';

View File

@@ -0,0 +1,40 @@
<?php
/**
* Search console ui.
*
* @package RankMath
* @subpackage RankMath\Admin\Wizard
*/
use RankMath\KB;
use RankMath\Google\Authentication;
defined( 'ABSPATH' ) || exit;
// phpcs:disable
$is_authorized = Authentication::is_authorized();
$authorize = ! $is_authorized ? ( '<div class="connect-wrap" style="margin-top: 30px;"><a href="' . esc_url( Authentication::get_auth_url() ) . '" class="button button-primary button-animated rank-math-authorize-account">' . esc_html__( 'Connect Google Services', 'rank-math' ) . '</a></div>' ) : '';
$deauthorize = $is_authorized ? '<button class="button button-primary rank-math-deauthorize-account">' . esc_html__( 'Disconnect Account', 'rank-math' ) . '</button>' : '';
echo $authorize . $deauthorize;
?>
<div id="rank-math-pro-cta" class="analytics">
<div class="rank-math-cta-box width-100 no-shadow no-padding no-border">
<h3><?php echo esc_attr__( 'Benefits of Connecting Google Account', 'rank-math' ); ?></h3>
<ul>
<li><?php echo esc_attr__( 'Verify site ownership on Google Search Console in a single click', 'rank-math' ); ?></li>
<li><?php echo esc_attr__( 'Track page and keyword rankings with the Advanced Analytics module', 'rank-math' ); ?></li>
<li><?php echo esc_attr__( 'Easily set up Google Analytics without using another 3rd party plugin', 'rank-math' ); ?></li>
<li><?php echo esc_attr__( 'Automatically submit sitemaps to the Google Search Console', 'rank-math' ); ?></li>
<li><a href="<?php echo KB::get( 'help-analytics', 'SW Analytics Step Benefits' ); ?>" target="_blank"><?php echo esc_html__( 'Learn more about the benefits of connecting your account here.', 'rank-math' ); ?></a></li>
</ul>
</div>
</div>
<div id="rank-math-pro-cta" class="rank-math-privacy-box">
<div class="rank-math-cta-table">
<div class="rank-math-cta-body less-padding">
<i class="dashicons dashicons-lock"></i>
<p><?php printf( esc_html__( 'We do not store any of the data from your Google account on our servers, everything is processed & stored on your server. We take your privacy extremely seriously and ensure it is never misused. %s', 'rank-math' ), '<a href="' . KB::get( 'usage-policy', 'Analytics Privacy Notice' ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Learn more.', 'rank-math' ) . '</a>' ); ?></p>
</div>
</div>
</div>

View File

@@ -0,0 +1,23 @@
<?php
/**
* Setup wizard header template.
*
* @package RankMath
* @subpackage RankMath\Admin\Wizard
*/
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
?>
<!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 esc_html_e( 'Setup Wizard - Rank Math', 'rank-math' ); ?></title>
<?php wp_print_head_scripts(); ?>
<?php wp_print_styles( 'rank-math-wizard' ); ?>
</head>
<body class="rank-math-wizard rank-math-page rank-math-wizard-body--<?php echo sanitize_html_class( $this->step_slug ); ?><?php echo is_rtl() ? ' rtl' : ''; ?><?php echo Helper::is_advanced_mode() ? ' rank-math-mode-advanced' : ' rank-math-mode-basic'; ?>">

View File

@@ -0,0 +1 @@
<?php // Silence is golden.

View File

@@ -0,0 +1,39 @@
<?php
/**
* Setup wizard navigation template.
*
* @package RankMath
* @subpackage RankMath\Admin\Wizard
*/
defined( 'ABSPATH' ) || exit;
$output_steps = $this->steps;
$array_keys = array_keys( $this->steps );
$current_step = array_search( $this->step, $array_keys, true );
?>
<div class="wizard-navigation">
<a class="step step-label" href="<?php echo esc_url( apply_filters( 'rank_math/wizard/step/label_url', \RankMath\Helper::get_admin_url( 'wizard' ) ) ); ?>" title="<?php echo apply_filters( 'rank_math/wizard/step/label', esc_html__( 'Getting Started', 'rank-math' ) ); ?>"></a>
<?php
foreach ( $output_steps as $step_key => $step ) :
if ( $this->is_nav_item_hidden( $step_key ) ) {
continue;
}
$class_attr = '';
if ( $step_key === $this->step ) {
$class_attr = 'active';
} elseif ( $current_step > array_search( $step_key, $array_keys, true ) ) {
$class_attr = 'done';
}
?>
<a class="<?php echo esc_attr( $class_attr ); ?>" href="<?php echo esc_url( $this->get_step_link( $step_key ) ); ?>" title="<?php echo esc_attr( $step['name'] ); ?>"><span></span></a>
<?php endforeach; ?>
</div>

View File

@@ -0,0 +1,13 @@
<?php
/**
* Setup wizard no navigation template.
*
* @package RankMath
* @subpackage RankMath\Admin\Wizard
*/
defined( 'ABSPATH' ) || exit;
?>
<br>
<br>

View File

@@ -0,0 +1,53 @@
<?php
/**
* Search console ui.
*
* @package RankMath
* @subpackage RankMath\Admin\Wizard
*/
use RankMath\KB;
use RankMath\Helpers\Param;
use RankMath\Admin\Admin_Helper;
defined( 'ABSPATH' ) || exit;
$page = Param::get( 'page', '', FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_BACKTICK );
$page = in_array( $page, [ 'rank-math-options-general', 'rank-math-analytics' ], true ) ? 'rank-math-options-general' : 'rank-math-wizard&step=analytics';
$url = Admin_Helper::get_activate_url( admin_url( 'admin.php?analytics=1&page=' . $page ) );
$site_url_valid = Admin_Helper::is_site_url_valid();
$button_class = 'button button-primary button-connect' . ( $site_url_valid ? ' button-animated' : ' disabled' );
?>
<?php Admin_Helper::maybe_show_invalid_siteurl_notice(); ?>
<div class="wp-core-ui rank-math-ui connect-wrap" style="margin-top: 30px;">
<a href="<?php echo esc_url( $url ); ?>" class="<?php echo esc_attr( $button_class ); ?>" name="rank_math_activate"><?php echo esc_attr__( 'Connect Your Rank Math Account', 'rank-math' ); ?></a>
</div>
<div id="rank-math-pro-cta" class="analytics">
<div class="rank-math-cta-box width-100 no-shadow no-padding no-border">
<h3><?php echo esc_attr__( 'Benefits of Connecting Rank Math Account', 'rank-math' ); ?></h3>
<ul>
<li><?php echo esc_attr__( 'Verify site ownership on Google Search Console in a single click', 'rank-math' ); ?></li>
<li><?php echo esc_attr__( 'Track page and keyword rankings with the Advanced Analytics module', 'rank-math' ); ?></li>
<li><?php echo esc_attr__( 'Easily set up Google Analytics without using another 3rd party plugin', 'rank-math' ); ?></li>
<li><?php echo esc_attr__( 'Automatically submit sitemaps to the Google Search Console', 'rank-math' ); ?></li>
<li><?php echo esc_attr__( 'Free keyword suggestions when entering a focus keyword', 'rank-math' ); ?></li>
<li><?php echo esc_attr__( 'Use our revolutionary SEO Analyzer to scan your website for SEO errors', 'rank-math' ); ?></li>
<li><a href="<?php echo esc_url( KB::get( 'free-account-benefits', 'SW Analytics Step' ) ); ?>" target="_blank"><?php echo esc_html__( 'Learn more about the benefits of connecting your account here.', 'rank-math' ); ?></a></li>
</ul>
</div>
</div>
<div id="rank-math-pro-cta" class="rank-math-privacy-box">
<div class="rank-math-cta-table">
<div class="rank-math-cta-body less-padding">
<i class="dashicons dashicons-lock"></i>
<p>
<?php
// Translators: placeholder is the KB link.
printf( esc_html__( 'We do not store any of the data from your Google account on our servers, everything is processed & stored on your server. We take your privacy extremely seriously and ensure it is never misused. %s', 'rank-math' ), '<a href="' . esc_url( KB::get( 'usage-policy', 'Analytics Privacy Notice' ) ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Learn more.', 'rank-math' ) . '</a>' );
?>
</p>
</div>
</div>
</div>

View File

@@ -0,0 +1,79 @@
<?php
/**
* Setup wizard ready step.
*
* @package RankMath
* @subpackage RankMath\Admin\Wizard
*/
use RankMath\KB;
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
?>
<header>
<h1>
<i class="dashicons dashicons-yes"></i> <?php esc_html_e( 'Your site is ready!', 'rank-math' ); ?>
<?php \RankMath\Admin\Admin_Helper::get_social_share(); ?>
</h1>
</header>
<div class="rank-math-additional-options">
<div class="rank-math-auto-update-wrapper">
<h3><?php esc_html_e( 'Enable auto update of the plugin', 'rank-math' ); ?></h3>
<span class="cmb2-toggle">
<input type="checkbox" class="rank-math-modules" id="auto-update" value="" <?php checked( Helper::get_auto_update_setting() ); ?> data-key="enable_auto_update" />
<label for="auto-update" class="cmb2-slider">
<svg width="3" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 6" class="toggle_on" role="img" aria-hidden="true" focusable="false"><path d="M0 0h2v6H0z"></path></svg>
<svg width="8" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 6" class="toggle_off" role="img" aria-hidden="true" focusable="false"><path d="M3 1.5c.8 0 1.5.7 1.5 1.5S3.8 4.5 3 4.5 1.5 3.8 1.5 3 2.2 1.5 3 1.5M3 0C1.3 0 0 1.3 0 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"></path></svg>
</label>
</span>
</div>
</div>
<br class="clear">
<?php if ( ! Helper::is_whitelabel() ) : ?>
<div class="wizard-next-steps wp-clearfix">
<div class="score-100">
<a href="<?php KB::the( 'score-100', 'SW Ready Score Image' ); ?>" target="_blank">
<img src="<?php echo esc_url( rank_math()->plugin_url() ); ?>/assets/admin/img/score-100.png">
</a>
</div>
<div class="learn-more">
<h2><?php esc_html_e( 'Learn more', 'rank-math' ); ?></h2>
<ul>
<li>
<?php if ( ! defined( 'RANK_MATH_PRO_FILE' ) ) { ?>
<span class="dashicons dashicons-star-filled pro"></span><a href="<?php KB::the( 'pro', 'SW Ready Step Upgrade' ); ?>" target="_blank"><strong class="pro-label"><?php esc_html_e( 'Know more about the PRO version', 'rank-math' ); ?></strong></a>
<?php } else { ?>
<span class="dashicons dashicons-video-alt3"></span><a href="<?php KB::the( 'yt-link', 'SW Ready Step Upgrade' ); ?>" target="_blank"><?php esc_html_e( 'Subscribe to Our YouTube Channel', 'rank-math' ); ?></a>
<?php } ?>
</li>
<li>
<span class="dashicons dashicons-facebook"></span><a href="<?php KB::the( 'fb-group', 'SW Ready Step Upgrade' ); ?>" target="_blank"><?php esc_html_e( 'Join FREE Facebook Group', 'rank-math' ); ?></a>
</li>
<li>
<span class="dashicons dashicons-welcome-learn-more"></span><a href="<?php KB::the( 'kb-seo-suite', 'SW Ready Step KB' ); ?>" target="_blank"><?php esc_html_e( 'Rank Math Knowledge Base', 'rank-math' ); ?></a>
</li>
<li>
<span class="dashicons dashicons-sos"></span><a href="<?php KB::the( 'support', 'SW Ready Step Support' ); ?>" target="_blank"><?php esc_html_e( 'Get 24x7 Support', 'rank-math' ); ?></a>
</li>
</ul>
</div>
</div>
<footer class="form-footer wp-core-ui rank-math-ui">
<a href="<?php echo esc_url( Helper::get_dashboard_url() ); ?>" class="button button-secondary rank-math-return-dashboard"><?php esc_html_e( 'Return to dashboard', 'rank-math' ); ?></a>
<a href="<?php echo esc_url( Helper::get_admin_url( '', 'view=help' ) ); ?>" class="button button-secondary"><?php esc_html_e( 'Proceed to Help Page', 'rank-math' ); ?></a>
<a href="<?php echo esc_url( $wizard->step_next_link() ); ?>" class="button button-primary rank-math-advanced-option"><?php esc_html_e( 'Setup Advanced Options', 'rank-math' ); ?></a>
<?php do_action( 'rank_math/wizard/ready_footer', $wizard ); ?>
</footer>
<?php else : ?>
<p><?php esc_html_e( 'Your site is now optimized.', 'rank-math' ); ?></p>
<footer class="form-footer wp-core-ui rank-math-ui">
<a href="<?php echo esc_url( Helper::get_admin_url( 'options-general' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Proceed to Settings', 'rank-math' ); ?></a>
</footer>
<?php
endif;

View File

@@ -0,0 +1,412 @@
<?php
/**
* Search console UI.
*
* @package RankMath
* @subpackage RankMath\Admin\Wizard
*/
use RankMath\KB;
use RankMath\Helper;
use RankMath\Google\Authentication;
use RankMath\Google\Permissions;
use RankMath\Analytics\Url_Inspection;
use RankMath\Helpers\Str;
use RankMath\Google\Analytics;
use RankMath\Google\Console;
defined( 'ABSPATH' ) || exit;
// phpcs:disable
if ( ! Helper::is_site_connected() ) {
require_once 'rank-math-connect.php';
return;
}
$is_authorized = Authentication::is_authorized();
if ( ! $is_authorized ) {
require_once 'google-connect.php';
return;
}
$profile = wp_parse_args(
get_option( 'rank_math_google_analytic_profile' ),
[
'profile' => '',
'country' => 'all',
]
);
$analytics = wp_parse_args(
get_option( 'rank_math_google_analytic_options' ),
[
'adsense_id' => '',
'account_id' => '',
'property_id' => '',
'view_id' => '',
'measurement_id' => '',
'stream_name' => '',
'country' => 'all',
'install_code' => false,
'anonymize_ip' => false,
'local_ga_js' => false,
'exclude_loggedin' => false,
]
);
$is_profile_connected = Console::is_console_connected();
$is_adsense_connected = ! empty( $analytics['adsense_id'] );
$is_analytics_connected = Analytics::is_analytics_connected();
$is_index_status_enabled = Url_Inspection::is_enabled() || ! $is_profile_connected;
$all_services = get_option( 'rank_math_analytics_all_services', [
'isVerified' => '',
'inSearchConsole' => '',
'hasSitemap' => '',
'hasAnalytics' => '',
'hasAnalyticsProperty' => '',
'homeUrl' => '',
'sites' => '',
'accounts' => [],
'adsenseAccounts' => [],
] );
$is_pro_active = defined( 'RANK_MATH_PRO_FILE' );
$is_ga4 = ! Str::starts_with( 'UA-', $analytics['property_id'] );
?>
<input type="hidden" class="cmb2-id-check-all-services" value="<?php echo $is_profile_connected && $is_analytics_connected ? '1' : '0'; ?>" />
<?php
$actions = [
'reconnect' => [
'link' => wp_nonce_url( admin_url( 'admin.php?reconnect=google' ), 'rank_math_reconnect_google' ),
'class' => 'rank-math-reconnect-google',
'text' => esc_html__( 'Reconnect', 'rank-math' ),
],
'disconnect' => [
'link' => '#',
'class' => 'rank-math-disconnect-google',
'text' => esc_html__( 'Disconnect', 'rank-math' ),
],
];
if ( Helper::is_advanced_mode() && ( $is_profile_connected || $is_adsense_connected || $is_analytics_connected ) ) {
$actions['test-connections'] = [
'link' => '#',
'class' => 'rank-math-test-connection-google',
'text' => esc_html__( 'Test Connections', 'rank-math' ),
];
}
$actions = apply_filters( 'rank_math/analytics/connect_actions', $actions );
?>
<div class="connect-actions">
<?php foreach( $actions as $action ) { ?>
<a href="<?php echo esc_attr( $action['link'] ); ?>" class="button button-link <?php echo esc_attr( $action['class'] ); ?>"><?php echo esc_html( $action['text'] ); ?></a>
<?php } ?>
</div>
<?php
$console_classes = Helper::classnames(
'rank-math-box no-padding rank-math-accordion rank-math-connect-search-console',
[
'connected' => $is_profile_connected,
'disconnected' => ! $is_profile_connected,
'disabled' => ! Permissions::has_console(),
]
);
$console_status_classes = Helper::classnames(
'rank-math-connection-status',
[
'rank-math-connection-status-success' => $is_profile_connected,
'rank-math-connection-status-error' => ! $is_profile_connected,
]
);
$console_status = $is_profile_connected ? 'Connected' : 'Not Connected';
?>
<div class="<?php echo esc_attr( $console_classes ); ?>" tabindex="0">
<header>
<h3><span class="rank-math-connection-status-wrap"><span class="<?php echo esc_attr( $console_status_classes ); ?>" title="<?php echo esc_attr( $console_status ); ?>"></span></span> <?php esc_html_e( 'Search Console', 'rank-math' ); ?></h3>
</header>
<div class="rank-math-accordion-content">
<?php
if ( ! Permissions::has_console() ) {
Permissions::print_warning();
} ?>
<div class="cmb-row cmb-type-select">
<div class="cmb-row-col">
<label for="site-console-profile"><?php esc_html_e( 'Site', 'rank-math' ); ?></label>
<select class="cmb2_select site-console-profile notrack" name="site-console-profile" id="site-console-profile" data-selected="<?php echo $profile['profile']; ?>" disabled="disabled">
<?php if ( $is_profile_connected ) : ?>
<option value="<?php echo $profile['profile']; ?>"><?php echo $profile['profile']; ?></option>
<?php endif; ?>
</select>
</div>
<?php do_action( 'rank_math/analytics/options/console' ); ?>
</div>
<div class="cmb-row cmb-type-toggle">
<div class="cmb-td">
<label class="cmb2-toggle">
<input type="checkbox" class="regular-text notrack" name="enable-index-status" id="enable-index-status" value="on"<?php checked( $is_index_status_enabled ); ?> <?php echo disabled( ! $is_profile_connected ) ?>>
<span class="cmb2-slider">
<svg width="3" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 6" class="toggle_on" role="img" aria-hidden="true" focusable="false"><path d="M0 0h2v6H0z"></path></svg>
<svg width="8" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 6" class="toggle_off" role="img" aria-hidden="true" focusable="false"><path d="M3 1.5c.8 0 1.5.7 1.5 1.5S3.8 4.5 3 4.5 1.5 3.8 1.5 3 2.2 1.5 3 1.5M3 0C1.3 0 0 1.3 0 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"></path></svg>
</span>
</label>
<label for="enable-index-status"><?php esc_html_e( 'Enable the Index Status tab', 'rank-math' ); ?></label>
<div class="cmb2-metabox-description"><?php esc_html_e( 'Enable this option to show the Index Status tab in the Analytics module.', 'rank-math' ); ?> <a href="<?php echo KB::get( 'url-inspection-api', 'SW Analytics Index Status Option' ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Learn more.', 'rank-math' ); ?></a></div>
</div>
</div>
</div>
</div>
<?php
$analytic_classes = Helper::classnames(
'rank-math-box no-padding rank-math-accordion rank-math-connect-analytics',
[
'connected' => $is_analytics_connected,
'disconnected' => ! $is_analytics_connected,
'disabled' => ! Permissions::has_analytics(),
]
);
$analytic_status_classes = Helper::classnames(
'rank-math-connection-status',
[
'rank-math-connection-status-success' => $is_analytics_connected,
'rank-math-connection-status-error' => ! $is_analytics_connected,
]
);
$analytic_status = $is_analytics_connected ? 'Connected' : 'Not Connected';
?>
<div class="<?php echo esc_attr( $analytic_classes ); ?>" tabindex="0">
<header>
<h3><span class="rank-math-connection-status-wrap"><span class="<?php echo esc_attr( $analytic_status_classes ); ?>" title="<?php echo esc_attr( $analytic_status ); ?>"></span></span><?php esc_html_e( 'Analytics', 'rank-math' ); ?></h3>
</header>
<div class="rank-math-accordion-content rank-math-analytics-content">
<?php
if ( ! Permissions::has_analytics() ) {
Permissions::print_warning();
} ?>
<p class="warning yellow">
<strong class="note"><?php echo esc_attr( 'Note', 'rank-math' ); ?></strong>
<?php
/* translators: GA4 KB link */
echo sprintf(
esc_html__( 'Ready to switch to Google Analytics 4? %s', 'rank-math' ),
'<a href="'. KB::get( 'using-ga4', 'Analytics GA4 KB' ) . '" target="_blank">' . esc_html__( 'Click here to know how', 'rank-math' ) . '</a>.'
);
?>
</p>
<div class="cmb-row cmb-type-select">
<div class="cmb-row-col">
<label for="site-analytics-account"><?php esc_html_e( 'Account', 'rank-math' ); ?></label>
<select class="cmb2_select site-analytics-account notrack" name="site-analytics-account" id="site-analytics-account" data-selected="<?php echo esc_attr( $analytics['account_id'] ); ?>" disabled="disabled">
<?php
if ( $is_analytics_connected ) :
$analytic_account = $all_services['accounts'][ $analytics['account_id'] ];
?>
<option value="<?php echo $analytics['account_id']; ?>"><?php echo $analytic_account['name']; ?></option>
<?php endif; ?>
</select>
</div>
<div class="cmb-row-col">
<label for="site-analytics-property"><?php esc_html_e( 'Property', 'rank-math' ); ?></label>
<select class="cmb2_select site-analytics-property notrack" name="site-analytics-property" id="site-analytics-property" data-selected="<?php echo esc_attr( $analytics['property_id'] ); ?>" disabled="disabled">
<?php
if ( $is_analytics_connected ) :
$analytic_property = $all_services['accounts'][ $analytics['account_id'] ]['properties'][ $analytics['property_id'] ]['name'];
?>
<option value="<?php echo $analytics['property_id']; ?>"><?php echo $analytic_property; ?></option>
<?php endif; ?>
</select>
</div>
<div class="cmb-row-col">
<label for="site-analytics-view">
<?php echo $is_ga4 ? esc_html__( 'Data Stream', 'rank-math' ) : esc_html__( 'View', 'rank-math' ); ?>
</label>
<select class="cmb2_select site-analytics-view notrack" name="site-analytics-view" id="site-analytics-view" data-selected="<?php echo esc_attr( $analytics['view_id'] ); ?>" disabled="disabled">
<?php
if ( $is_analytics_connected ) :
$analytic_view = $is_ga4 ? $analytics['stream_name'] : $all_services['accounts'][ $analytics['account_id'] ]['properties'][ $analytics['property_id'] ]['profiles'][ $analytics['view_id'] ]['name'];
$analytic_view = $is_ga4 && ! $analytic_view && ! empty( $analytics['view_id'] ) ? 'Website' : $analytic_view;
?>
<option value="<?php echo esc_attr( $analytics['view_id'] ); ?>"><?php echo esc_attr( $analytic_view ); ?></option>
<?php
endif;
?>
</select>
</div>
<input type="hidden" id="rank-math-analytics-measurement-id" name="measurementID" value="<?php echo esc_attr( $analytics['measurement_id'] ) ?>" />
<input type="hidden" id="rank-math-analytics-stream-name" name="streamName" value="<?php echo esc_attr( $analytics['stream_name'] ) ?>" />
<?php do_action( 'rank_math/analytics/options/analytics' ); ?>
</div>
<div class="cmb-row cmb-type-toggle">
<div class="cmb-td">
<label class="cmb2-toggle">
<input type="checkbox" class="regular-text notrack" name="install-code" id="install-code" value="on"<?php checked( $analytics['install_code'] ); ?>>
<span class="cmb2-slider">
<svg width="3" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 6" class="toggle_on" role="img" aria-hidden="true" focusable="false"><path d="M0 0h2v6H0z"></path></svg>
<svg width="8" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 6" class="toggle_off" role="img" aria-hidden="true" focusable="false"><path d="M3 1.5c.8 0 1.5.7 1.5 1.5S3.8 4.5 3 4.5 1.5 3.8 1.5 3 2.2 1.5 3 1.5M3 0C1.3 0 0 1.3 0 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"></path></svg>
</span>
</label>
<label for="install-code"><?php esc_html_e( 'Install analytics code', 'rank-math' ); ?></label>
<div class="cmb2-metabox-description"><?php esc_html_e( 'Enable this option only if you are not using any other plugin/theme to install Google Analytics code.', 'rank-math' ); ?></div>
</div>
</div>
<div class="cmb-row cmb-type-toggle <?php echo ! $is_pro_active ? 'cmb-redirector-element' : ''; ?>" <?php echo ! $is_pro_active ? 'data-url="' . KB::the( 'free-vs-pro', 'Anonymize IP' ) .'"' : ''; ?>>
<div class="cmb-td">
<label class="cmb2-toggle">
<input type="checkbox" class="regular-text notrack" name="anonymize-ip" id="anonymize-ip" value="on"<?php checked( $analytics['anonymize_ip'] ); ?><?php disabled( ! $is_pro_active ); ?>>
<span class="cmb2-slider<?php echo ! $is_pro_active ? ' disabled' : ''; ?> ">
<svg width="3" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 6" class="toggle_on" role="img" aria-hidden="true" focusable="false"><path d="M0 0h2v6H0z"></path></svg>
<svg width="8" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 6" class="toggle_off" role="img" aria-hidden="true" focusable="false"><path d="M3 1.5c.8 0 1.5.7 1.5 1.5S3.8 4.5 3 4.5 1.5 3.8 1.5 3 2.2 1.5 3 1.5M3 0C1.3 0 0 1.3 0 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"></path></svg>
</span>
</label>
<label for="anonymize-ip">
<?php esc_html_e( 'Anonymize IP addresses', 'rank-math' ); ?>
<?php if ( ! $is_pro_active ) : ?>
<span class="rank-math-pro-badge">
<a href="<?php KB::the( 'pro', 'Anonymize IP' ); ?>" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'PRO', 'rank-math' ); ?>
</a>
</span>
<?php endif; ?>
</label>
<div class="rank-math-cmb-dependency hidden" data-relation="or">
<span class="hidden" data-field="install-code" data-comparison="=" data-value="on"></span>
</div>
</div>
</div>
<div class="cmb-row cmb-type-toggle <?php echo ! $is_pro_active ? 'cmb-redirector-element' : ''; ?>" <?php echo ! $is_pro_active ? 'data-url="' . KB::the( 'pro', 'Localjs IP' ) . '"' : ''; ?>>
<div class="cmb-td">
<label class="cmb2-toggle">
<input type="checkbox" class="regular-text notrack" name="local-ga-js" id="local-ga-js" value="on"<?php checked( $analytics['local_ga_js'] ); ?><?php disabled( ! $is_pro_active ); ?>>
<span class="cmb2-slider<?php echo ! $is_pro_active ? ' disabled' : ''; ?> ">
<svg width="3" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 6" class="toggle_on" role="img" aria-hidden="true" focusable="false"><path d="M0 0h2v6H0z"></path></svg>
<svg width="8" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 6" class="toggle_off" role="img" aria-hidden="true" focusable="false"><path d="M3 1.5c.8 0 1.5.7 1.5 1.5S3.8 4.5 3 4.5 1.5 3.8 1.5 3 2.2 1.5 3 1.5M3 0C1.3 0 0 1.3 0 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"></path></svg>
</span>
</label>
<label for="local-ga-js">
<?php esc_html_e( 'Self-Hosted Analytics JS File', 'rank-math' ); ?>
<?php if ( ! $is_pro_active ) : ?>
<span class="rank-math-pro-badge">
<a href="<?php KB::the( 'pro', 'Localjs IP' ); ?>" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'PRO', 'rank-math' ); ?>
</a>
</span>
<?php endif; ?>
</label>
<div class="rank-math-cmb-dependency hidden" data-relation="or">
<span class="hidden" data-field="install-code" data-comparison="=" data-value="on"></span>
</div>
</div>
</div>
<div class="cmb-row cmb-type-toggle">
<div class="cmb-td">
<label class="cmb2-toggle">
<input type="checkbox" class="regular-text notrack" name="exclude-loggedin" id="exclude-loggedin" value="on"<?php checked( $analytics['exclude_loggedin'] ); ?>>
<span class="cmb2-slider">
<svg width="3" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 6" class="toggle_on" role="img" aria-hidden="true" focusable="false"><path d="M0 0h2v6H0z"></path></svg>
<svg width="8" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 6" class="toggle_off" role="img" aria-hidden="true" focusable="false"><path d="M3 1.5c.8 0 1.5.7 1.5 1.5S3.8 4.5 3 4.5 1.5 3.8 1.5 3 2.2 1.5 3 1.5M3 0C1.3 0 0 1.3 0 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"></path></svg>
</span>
</label>
<label for="exclude-loggedin"><?php esc_html_e( 'Exclude Logged-in users', 'rank-math' ); ?></label>
<div class="rank-math-cmb-dependency hidden" data-relation="or">
<span class="hidden" data-field="install-code" data-comparison="=" data-value="on"></span>
</div>
</div>
</div>
</div>
</div>
<?php
$adsense_classes = Helper::classnames(
'rank-math-box no-padding rank-math-accordion rank-math-connect-adsense',
[
'connected' => $is_adsense_connected,
'disconnected' => ! $is_adsense_connected,
'disabled' => ! Permissions::has_adsense(),
]
);
$adsense_status_classes = Helper::classnames(
'rank-math-connection-status',
[
'rank-math-connection-status-success' => Permissions::has_adsense() && $is_adsense_connected,
'rank-math-connection-status-error' => Permissions::has_adsense() && ! $is_adsense_connected,
]
);
$adsense_status = $is_adsense_connected ? 'Connected' : 'Not Connected';
?>
<div class="<?php echo esc_attr( $adsense_classes ); ?>" tabindex="0">
<header>
<h3><span class="rank-math-connection-status-wrap"><span class="<?php echo esc_attr( $adsense_status_classes ); ?>" title="<?php echo esc_attr( $adsense_status ); ?>"></span></span><?php esc_html_e( 'AdSense', 'rank-math' ); ?></h3>
</header>
<div class="rank-math-accordion-content">
<?php
if ( defined( 'RANK_MATH_PRO_FILE' ) && ! Permissions::has_adsense() ) {
Permissions::print_warning();
} ?>
<div class="cmb-row cmb-type-select">
<div class="cmb-row-col">
<label for="site-adsense-account"><?php esc_html_e( 'Account', 'rank-math' ); ?></label>
<select class="cmb2_select site-adsense-account notrack" name="site-adsense-account" id="site-adsense-account" data-selected="<?php echo esc_attr( $analytics['adsense_id'] ); ?>" disabled="disabled">
<?php
if ( $is_adsense_connected ) :
$adsense = $all_services['adsenseAccounts'][ $analytics['adsense_id'] ];
?>
<option value="<?php echo $analytics['adsense_id']; ?>"><?php echo $adsense['name']; ?></option>
<?php endif; ?>
</select>
</div>
</div>
<?php if ( ! $is_pro_active ) : ?>
<div id="rank-math-pro-cta" class="no-margin">
<div class="rank-math-cta-text">
<span class="rank-math-pro-badge"><a href="<?php KB::the( 'pro', 'AdSense Toggle' ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'PRO', 'rank-math' ); ?></a></span> <?php esc_html_e( "Google AdSense support is only available in Rank Math Pro's Advanced Analytics module.", 'rank-math' ); ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<div id="rank-math-pro-cta" class="rank-math-privacy-box width-100">
<div class="rank-math-cta-table">
<div class="rank-math-cta-body less-padding">
<i class="dashicons dashicons-lock"></i>
<p><?php printf( esc_html__( 'We do not store any of the data from your Google account on our servers, everything is processed & stored on your server. We take your privacy extremely seriously and ensure it is never misused. %s', 'rank-math' ), '<a href="' . KB::get( 'usage-policy', 'Analytics Privacy Notice' ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Learn more.', 'rank-math' ) . '</a>' ); ?></p>
</div>
</div>
</div>
<?php
// phpcs:enable
if ( Helper::is_wizard() && ! RankMath\Analytics\Email_Reports::are_fields_hidden() ) {
?>
<div class="cmb-row email-reports-header text-center" style="border-top:0;">
<h1><?php esc_html_e( 'Email Reports', 'rank-math' ); ?></h1>
<div class="email-reports-desc text-center"><?php esc_html_e( 'Receive Analytics reports periodically in email.', 'rank-math' ); ?> <a href="#" target="_blank"><?php esc_html_e( 'Learn more about Email Reports.', 'rank-math' ); ?></a></div>
</div>
<div class="cmb-row cmb-type-toggle cmb2-id-console-email-reports" data-fieldtype="toggle">
<div class="cmb-th">
<label for="console_email_reports"><?php esc_html_e( 'Email Reports', 'rank-math' ); ?></label>
</div>
<div class="cmb-td">
<label class="cmb2-toggle"><input type="checkbox" class="regular-text" name="console_email_reports" id="console_email_reports" value="on" <?php checked( Helper::get_settings( 'general.console_email_reports' ) ); ?> data-hash="7e0rimtbvig0"><span class="cmb2-slider"><svg width="3" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 6" class="toggle_on" role="img" aria-hidden="true" focusable="false"><path d="M0 0h2v6H0z"></path></svg><svg width="8" height="8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 6" class="toggle_off" role="img" aria-hidden="true" focusable="false"><path d="M3 1.5c.8 0 1.5.7 1.5 1.5S3.8 4.5 3 4.5 1.5 3.8 1.5 3 2.2 1.5 3 1.5M3 0C1.3 0 0 1.3 0 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"></path></svg></span></label>
</div>
</div>
<?php
do_action( 'rank_math/analytics/options/wizard_after_email_report' );
}

View File

@@ -0,0 +1,66 @@
<?php
/**
* Setup wizard your site step.
*
* @package RankMath
* @subpackage RankMath\Admin\Wizard
*/
use RankMath\Helper;
use RankMath\KB;
defined( 'ABSPATH' ) || exit;
?>
<header>
<h1>
<?php
/* translators: sitename */
printf( esc_html__( 'Your Website: %s', 'rank-math' ), esc_attr( $this->get_site_display_name() ) );
?>
</h1>
<p><?php esc_html_e( 'Let us know a few things about your site&hellip;', 'rank-math' ); ?></p>
</header>
<?php if ( ! Helper::is_whitelabel() ) : ?>
<div class="rank-math-wizard-tutorial">
<header>
<?php
printf(
/* translators: help link */
esc_html__( 'If you are new to Rank Math, %s to learn more.', 'rank-math' ),
'<a href="#" data-target="rank-math-wizard-tabs" class="rank-math-collapsible-trigger">' . esc_html__( 'click here', 'rank-math' ) . '</a>'
);
?>
</header>
<div id="rank-math-wizard-tabs" class="rank-math-collapsible-content rank-math-tabs">
<div class="rank-math-tabs-navigation rank-math-custom wp-clearfix">
<a href="#help-panel-video" class="active"><span class="rm-icon rm-icon-video"></span><?php esc_html_e( 'Setup Tutorial', 'rank-math' ); ?></a>
<a href="#help-panel-knowledge"><span class="rm-icon rm-icon-post"></span><?php esc_html_e( 'Knowledge Base', 'rank-math' ); ?></a>
</div>
<div class="rank-math-tabs-content rank-math-custom">
<div id="help-panel-video" class="rank-math-tab">
<a href="<?php KB::the( 'how-to-setup-your-site', 'SW Your Site Setup KB' ); ?>" target="_blank" style="font-size: 15px; border-bottom: 1px dashed;">
<?php echo esc_html_e( 'Click here to learn how to setup Rank Math properly', 'rank-math' ); ?>
</a>
</div>
<div id="help-panel-knowledge" class="rank-math-tab">
<div class="search-form wp-core-ui rank-math-ui">
<label for="rank-math-search-input"><?php esc_html_e( 'Search the Knowledge Base for answers to your questions:', 'rank-math' ); ?></label>
<input type="text" class="regular-text" id="rank-math-search-input" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" placeholder="<?php esc_attr_e( 'Type here to search...', 'rank-math' ); ?>" value="">
<a data-href="<?php KB::the( 'kb-search', 'SW Your Site Search' ); ?>&s=&lang=<?php echo get_locale(); ?>" target="_blank" class="button button-primary"><?php esc_html_e( 'Search', 'rank-math' ); ?></a>
</div>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?php $wizard->cmb->show_form(); ?>
<footer class="form-footer wp-core-ui rank-math-ui">
<?php $wizard->get_skip_link(); ?>
<button type="submit" class="button button-primary"><?php esc_html_e( 'Save and Continue', 'rank-math' ); ?></button>
</footer>