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,32 @@
<?php
/**
* Dashboard page template.
*
* @package RankMath
* @subpackage RankMath\Admin
*/
use RankMath\Helper;
use RankMath\Google\Authentication;
defined( 'ABSPATH' ) || exit;
// Header.
rank_math()->admin->display_admin_header();
$path = rank_math()->admin_dir() . 'wizard/views/'; // phpcs:ignore
?>
<div class="wrap rank-math-wrap analytics">
<span class="wp-header-end"></span>
<?php
if ( ! Helper::is_site_connected() ) {
require_once $path . 'rank-math-connect.php';
} elseif ( ! Authentication::is_authorized() ) {
require_once $path . 'google-connect.php';
} else {
echo '<div class="rank-math-analytics" id="rank-math-analytics"></div>';
}
?>
</div>

View File

@@ -0,0 +1,22 @@
<?php
/**
* Analytics Report header template.
*
* @package RankMath
* @subpackage RankMath\Admin
*/
use RankMath\KB;
defined( 'ABSPATH' ) || exit;
?>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="cta">
<tbody>
<tr class="top">
<td align="left">
<a href="<?php KB::the( 'seo-email-reporting', 'Email Report CTA' ); ?>"><?php $this->image( 'rank-math-pro.jpg', 540, 422, __( 'Rank Math PRO', 'rank-math' ) ); ?></a>
</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,39 @@
<?php
/**
* Analytics Report email template footer.
*
* @package RankMath
* @subpackage RankMath\Admin
*/
defined( 'ABSPATH' ) || exit;
?>
</td>
</tr>
</table>
</td>
</tr>
<!-- START FOOTER -->
<tr class="footer">
<td class="wrapper">
<p class="first">
###FOOTER_HTML###
</p>
</td>
</tr>
<!-- END FOOTER -->
<!-- END MAIN CONTENT AREA -->
</table>
<!-- END CENTERED WHITE CONTAINER -->
</div>
</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,42 @@
<?php
/**
* Analytics Report header template.
*
* @package RankMath
* @subpackage RankMath\Admin
*/
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
?>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="report-info">
<tr>
<td>
<h1><?php esc_html_e( 'SEO Report of Your Website', 'rank-math' ); ?></h1>
<h2 class="report-date">###START_DATE### - ###END_DATE###</h2>
<a href="###SITE_URL###" target="_blank" class="site-url">###SITE_URL_SIMPLE###</a>
</td>
<td class="full-report-link">
<a href="###REPORT_URL###" target="_blank" class="full-report-link">
<?php esc_html_e( 'FULL REPORT', 'rank-math' ); ?>
<?php $this->image( 'report-icon-external.png', 12, 12, __( 'External Link Icon', 'rank-math' ) ); ?>
</a>
</td>
</tr>
</table>
<?php if ( $this->get_variable( 'stats_invalid_data' ) ) { ?>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="report-error">
<tr>
<td>
<h2><?php esc_html_e( 'Uh-oh', 'rank-math' ); ?></h2>
<p><em><?php esc_html_e( 'It seems that there are no stats to show right now.', 'rank-math' ); ?></em></p>
<?php // Translators: placeholders are anchor opening and closing tags. ?>
<p><?php printf( esc_html__( 'If you can see the site data in your Search Console and Analytics accounts, but not here, then %1$s try reconnecting your account %2$s and make sure that the correct properties are selected in the %1$s Analytics Settings%2$s.', 'rank-math' ), '<a href="' . Helper::get_admin_url( 'options-general#setting-panel-analytics' ) . '">', '</a>' ); ?></p>
</td>
</tr>
</table>
<?php
}

View File

@@ -0,0 +1,56 @@
<?php
/**
* Analytics Report header template.
*
* @package RankMath
* @subpackage RankMath\Admin
*/
defined( 'ABSPATH' ) || exit;
?><!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php esc_html_e( 'SEO Report of Your Website', 'rank-math' ); ?></title>
<?php $this->template_part( 'style' ); ?>
</head>
<body class="">
<span class="preheader"><?php esc_html_e( 'SEO Report of Your Website', 'rank-math' ); ?></span>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="body">
<tr>
<td>&nbsp;</td>
<td class="container">
<div class="content">
<!-- START CENTERED WHITE CONTAINER -->
<table role="presentation" class="main" border="0" cellpadding="0" cellspacing="0">
<!-- START HEADER -->
<tr>
<td class="header">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="logo">
<a href="###LOGO_LINK###" target="_blank">
<?php $this->image( 'report-logo.png', 0, 26, __( 'Rank Math', 'rank-math' ) ); ?>
</a>
</td>
<td class="period-days">
<?php // Translators: don't translate the variable names between the #hashes#. ?>
<?php esc_html_e( 'Last ###PERIOD_DAYS### Days', 'rank-math' ); ?>
</td>
</tr>
</table>
</td>
</tr>
<!-- END HEADER -->
<!-- START MAIN CONTENT AREA -->
<tr>
<td class="wrapper">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>

View File

@@ -0,0 +1,24 @@
<?php
/**
* Analytics Report email template.
*
* @package RankMath
* @subpackage RankMath\Admin
*/
defined( 'ABSPATH' ) || exit;
$this->template_part( 'header' );
?>
<?php $this->template_part( 'header-after' ); ?>
<?php $this->template_part( 'sections/summary' ); ?>
<?php $this->template_part( 'sections/positions' ); ?>
<?php $this->template_part( 'cta' ); ?>
<?php
$this->template_part( 'footer' );

View File

@@ -0,0 +1,56 @@
<?php
/**
* Analytics Report summary table template.
*
* @package RankMath
* @subpackage RankMath\Admin
*/
defined( 'ABSPATH' ) || exit;
?>
<?php if ( $this->get_variable( 'stats_invalid_data' ) ) { ?>
<?php return; ?>
<?php } ?>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="stats-2">
<tr>
<td class="col-1">
<h3><?php esc_html_e( 'Top 3 Positions', 'rank-math' ); ?></h3>
<?php
$this->template_part(
'stat',
[
'value' => $this->get_variable( 'stats_top_3_positions' ),
'diff' => $this->get_variable( 'stats_top_3_positions_diff' ),
]
);
?>
</td>
<td class="col-2">
<h3><?php esc_html_e( '4-10 Positions', 'rank-math' ); ?></h3>
<?php
$this->template_part(
'stat',
[
'value' => $this->get_variable( 'stats_top_10_positions' ),
'diff' => $this->get_variable( 'stats_top_10_positions_diff' ),
]
);
?>
</td>
<td class="col-3">
<h3><?php esc_html_e( '11-50 Positions', 'rank-math' ); ?></h3>
<?php
$this->template_part(
'stat',
[
'value' => $this->get_variable( 'stats_top_50_positions' ),
'diff' => $this->get_variable( 'stats_top_50_positions_diff' ),
]
);
?>
</td>
</tr>
</table>

View File

@@ -0,0 +1,81 @@
<?php
/**
* Analytics Report summary table template.
*
* @package RankMath
* @subpackage RankMath\Admin
*/
defined( 'ABSPATH' ) || exit;
?>
<?php if ( $this->get_variable( 'stats_invalid_data' ) ) { ?>
<?php return; ?>
<?php } ?>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="stats">
<tr>
<td class="col-1">
<h3><?php esc_html_e( 'Total Impressions', 'rank-math' ); ?></h3>
<?php
$this->template_part(
'stat',
[
'value' => $this->get_variable( 'stats_impressions' ),
'diff' => $this->get_variable( 'stats_impressions_diff' ),
'graph' => true,
'graph_data' => $this->get_graph_data( 'impressions' ),
]
);
?>
</td>
<td class="col-2">
<h3><?php esc_html_e( 'Total Clicks', 'rank-math' ); ?></h3>
<?php
$this->template_part(
'stat',
[
'value' => $this->get_variable( 'stats_clicks' ),
'diff' => $this->get_variable( 'stats_clicks_diff' ),
'graph' => true,
'graph_data' => $this->get_graph_data( 'clicks' ),
]
);
?>
</td>
</tr>
<tr>
<td class="col-1">
<h3><?php esc_html_e( 'Total Keywords', 'rank-math' ); ?></h3>
<?php
$this->template_part(
'stat',
[
'value' => $this->get_variable( 'stats_keywords' ),
'diff' => $this->get_variable( 'stats_keywords_diff' ),
'graph' => true,
'graph_data' => $this->get_graph_data( 'keywords' ),
]
);
?>
</td>
<td class="col-2">
<h3><?php esc_html_e( 'Average Position', 'rank-math' ); ?></h3>
<?php
$this->template_part(
'stat',
[
'value' => $this->get_variable( 'stats_position' ),
'diff' => $this->get_variable( 'stats_position_diff' ),
'graph' => true,
'graph_data' => $this->get_graph_data( 'position' ),
'graph_modifier' => -100,
'human_number' => false,
'invert' => true,
]
);
?>
</td>
</tr>
</table>

View File

@@ -0,0 +1,69 @@
<?php
/**
* Analytics Report header template.
*
* @package RankMath
* @subpackage RankMath\Admin
*/
use RankMath\Helpers\Str;
defined( 'ABSPATH' ) || exit;
$diff_class = $diff > 0 ? 'positive' : 'negative';
if ( ! empty( $invert ) ) {
$diff_class = $diff < 0 ? 'positive' : 'negative';
}
$diff_sign = '<span class="diff-sign">' . ( 'positive' === $diff_class ? '&#9650;' : '&#9660;' ) . '</span>';
if ( 0.0 === floatval( $diff ) ) {
$diff_class = 'no-diff';
$diff_sign = '';
}
$stat_value = $value;
$stat_diff = abs( $diff );
// Human number is 'true' by default.
if ( ! isset( $human_number ) || $human_number ) {
$stat_value = Str::human_number( $stat_value );
$stat_diff = Str::human_number( $stat_diff );
}
?>
<span class="stat-value">
<?php echo esc_html( $stat_value ); ?>
</span>
<span class="stat-diff <?php echo sanitize_html_class( $diff_class ); ?>">
<?php echo $diff_sign . ' ' . esc_html( $stat_diff ); // phpcs:ignore ?>
</span>
<?php
if ( ! empty( $graph ) && ! empty( $graph_data ) ) {
$show_graph = false;
// Check data points.
foreach ( $graph_data as $key => $value ) {
if ( ! empty( $value ) ) {
$show_graph = true;
}
// Adjust values.
if ( ! empty( $graph_modifier ) ) {
$graph_data[ $key ] = abs( $graph_data[ $key ] + $graph_modifier );
}
}
if ( ! $show_graph ) {
return;
}
// `img` tag size.
// Actual image size is 3x this.
$width = 64;
$height = 34;
$this->image( $this->charts_api_url( $graph_data, $width * 3, $height * 3 ), $width, $height, __( 'Data Chart', 'rank-math' ), [ 'style' => 'float: right;margin-top: -7px;' ] );
} ?>

View File

@@ -0,0 +1,496 @@
<?php
/**
* Analytics Report email styling.
*
* @package RankMath
* @subpackage RankMath\Admin
*/
defined( 'ABSPATH' ) || exit;
?>
<style>
/* -------------------------------------
GLOBAL RESETS
------------------------------------- */
/* All the styling goes here */
img {
border: none;
-ms-interpolation-mode: bicubic;
max-width: 100%;
}
body {
background-color: #f7f9fb;
-webkit-font-smoothing: antialiased;
font-size: 14px;
line-height: 1.4;
margin: 0;
padding: 0;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
table {
border-collapse: separate;
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
width: 100%;
}
table td {
font-size: 15px;
vertical-align: top;
}
/* -------------------------------------
BODY & CONTAINER
------------------------------------- */
.body, td {
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
}
.body {
background-color: #F0F4F8;
width: 100%;
}
/* Set a max-width, and make it display as block. */
.container {
display: block;
margin: 0 auto !important;
/* makes it centered */
max-width: 90%;
padding: 50px 0;
width: 600px;
}
.content {
box-sizing: border-box;
display: block;
margin: 0 auto;
width: 100%;
}
/* -------------------------------------
HEADER, FOOTER, MAIN
------------------------------------- */
.main {
background: #ffffff;
border-radius: 6px;
width: 100%;
color: #1a1e22;
}
.wrapper {
box-sizing: border-box;
padding: 30px 30px 60px;
}
.header {
background: #724BB7;
background: linear-gradient(90deg, #724BB7 0%, #4098D7 100%);
border-radius: 8px 8px 0 0;
height: 76px;
vertical-align: middle;
padding: 0 30px;
color: #ffffff;
}
td.logo {
vertical-align: middle;
}
td.logo img {
width: auto;
height: 26px;
margin-top: 6px;
}
.period-days {
text-align: right;
vertical-align: middle;
font-weight: 500;
letter-spacing: 0.5px;
font-size: 14px;
}
.content-block {
padding-bottom: 10px;
padding-top: 10px;
}
.footer {
clear: both;
margin-top: 10px;
width: 100%;
}
.footer .wrapper {
padding-bottom: 30px;
}
.footer td,
.footer p,
.footer span {
color: #999ba7;
font-size: 14px;
}
.footer td {
padding-top: 0;
}
.footer p.first {
padding-top: 20px;
border-top: 1px solid #e5e5e7;
line-height: 1.8;
margin-bottom: 0;
}
.footer .rank-math-contact-address {
font-style: normal;
}
.footer p:empty {
display: none;
}
.footer address {
display: inline-block;
font-style: normal;
margin-top: 10px;
}
/* -------------------------------------
TYPOGRAPHY
------------------------------------- */
h1,
h2,
h3,
h4 {
color: #000000;
font-weight: 600;
line-height: 1.4;
margin: 0;
}
h1 {
font-size: 30px;
}
p,
ul,
ol {
font-size: 14px;
font-weight: normal;
margin: 0;
margin-bottom: 15px;
}
p li,
ul li,
ol li {
list-style-position: inside;
margin-left: 5px;
}
a {
color: #22a8e6;
text-decoration: none;
}
h2.report-date {
margin: 25px 0 4px;
font-size: 18px;
}
.site-url {
color: #595d6f;
text-decoration: none;
font-size: 15px;
}
.full-report-link {
vertical-align: bottom;
text-align: right;
width: 110px;
}
.full-report-link a {
font-size: 12px;
font-weight: 600;
text-decoration: none;
}
.full-report-link img {
vertical-align: -1px;
margin-left: 2px;
}
table.report-error {
border: 2px solid #f1d400;
background: #fffdec;
margin: 10px 0;
}
table.report-error td {
padding: 5px 10px;
}
table.stats {
border-collapse: separate;
margin-top: 10px;
}
table.stats td {
width: 50%;
padding: 20px 20px;
background: #f7f9fb;
border: 10px solid #fff;
border-radius: 16px;
}
table.stats td.col-2 {
border-right: none;
}
table.stats td.col-1 {
border-left: none;
}
h3 {
font-size: 13px;
font-weight: 500;
color: #565a6b;
text-transform: uppercase;
}
.stat-value {
color: #000000;
font-size: 25px;
font-weight: 700;
}
.stat-diff {
font-size: 14px;
font-weight: 500;
}
.stat-diff.positive {
color: #339e75;
}
span.stat-diff.negative {
color: #e2454f;
}
.stat-diff.no-diff {
color: #999ba7;
}
.diff-sign {
font-size: 10px;
}
.stats-2 {
margin: 50px 0 24px;
}
.stats-2 td.col-1, .stats-2 td.col-2 {
border-right: 3px solid #f7f9fb;
}
.stats-2 td.col-2, .stats-2 td.col-3 {
padding-left: 40px;
}
.cta {
margin-bottom: 0;
}
/* -------------------------------------
BUTTONS
------------------------------------- */
.btn {
box-sizing: border-box;
width: 100%;
}
.btn > tbody > tr > td {
padding-bottom: 48px;
text-align: center;
padding-top: 34px;
}
.btn table {
width: auto;
}
.btn table td {
background-color: #ffffff;
border-radius: 5px;
text-align: center;
}
.btn a {
border: none;
border-radius: 31px;
box-sizing: border-box;
color: #59403b;
cursor: pointer;
display: inline-block;
font-size: 16px;
font-weight: 700;
margin: 0;
padding: 18px 44px;
text-decoration: none;
text-transform: capitalize;
background: rgb(47,166,129);
background: linear-gradient( 0deg, #f7d070 0%, #f7dc6f 100%);
letter-spacing: 0.7px;
}
.btn-primary table td {
background-color: #3498db;
}
/* -------------------------------------
OTHER STYLES THAT MIGHT BE USEFUL
------------------------------------- */
.last {
margin-bottom: 0;
}
.first {
margin-top: 0;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
.align-left {
text-align: left;
}
.clear {
clear: both;
}
.mt0 {
margin-top: 0;
}
.mb0 {
margin-bottom: 0;
}
.preheader {
color: transparent;
display: none;
height: 0;
max-height: 0;
max-width: 0;
opacity: 0;
overflow: hidden;
mso-hide: all;
visibility: hidden;
width: 0;
}
hr {
border: 0;
border-bottom: 1px solid #F0F4F8;
margin: 20px 0;
}
/* -------------------------------------
RESPONSIVE AND MOBILE FRIENDLY STYLES
------------------------------------- */
@media only screen and (max-width: 620px) {
table[class=body] h1 {
font-size: 28px !important;
margin-bottom: 10px !important;
}
table[class=body] p,
table[class=body] ul,
table[class=body] ol,
table[class=body] td,
table[class=body] span,
table[class=body] a {
font-size: 16px !important;
}
table[class=body] .wrapper,
table[class=body] .article {
padding: 10px !important;
}
table[class=body] .content {
padding: 0 !important;
}
table[class=body] .container {
padding: 0 !important;
width: 100% !important;
}
table[class=body] .main {
border-left-width: 0 !important;
border-radius: 0 !important;
border-right-width: 0 !important;
}
table[class=body] .btn table {
width: 100% !important;
}
table[class=body] .btn a {
width: 100% !important;
}
table[class=body] .img-responsive {
height: auto !important;
max-width: 100% !important;
width: auto !important;
}
}
/* -------------------------------------
PRESERVE THESE STYLES IN THE HEAD
------------------------------------- */
@media all {
.ExternalClass {
width: 100%;
}
.ExternalClass,
.ExternalClass p,
.ExternalClass span,
.ExternalClass font,
.ExternalClass td,
.ExternalClass div {
line-height: 100%;
}
.rankmath-link a {
color: inherit !important;
font-family: inherit !important;
font-size: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
text-decoration: none !important;
}
#MessageViewBody a {
color: inherit;
text-decoration: none;
font-size: inherit;
font-family: inherit;
font-weight: inherit;
line-height: inherit;
}
.btn-primary table td:hover {
background-color: #34495e !important;
}
.btn-primary a:hover {
background-color: #34495e !important;
border-color: #34495e !important;
}
}
</style>
<?php $this->template_part( 'pro-style' ); ?>

View File

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

View File

@@ -0,0 +1,165 @@
<?php
/**
* Search console options.
*
* @package Rank_Math
*/
use RankMath\KB;
use RankMath\Helper;
use RankMath\Analytics\DB;
use RankMath\Helpers\Str;
use RankMath\Google\Authentication;
defined( 'ABSPATH' ) || exit;
// phpcs:disable
$actions = \as_get_scheduled_actions(
[
'hook' => 'rank_math/analytics/clear_cache',
'status' => \ActionScheduler_Store::STATUS_PENDING,
]
);
$db_info = DB::info();
$is_queue_empty = empty( $actions );
$disable = ( ! Authentication::is_authorized() || ! $is_queue_empty ) ? true : false;
if ( ! empty( $db_info ) ) {
$db_info = [
/* translators: number of days */
'<div class="rank-math-console-db-info"><i class="rm-icon rm-icon-calendar"></i> ' . sprintf( esc_html__( 'Storage Days: %s', 'rank-math' ), '<strong>' . $db_info['days'] . '</strong>' ) . '</div>',
/* translators: number of rows */
'<div class="rank-math-console-db-info"><i class="rm-icon rm-icon-faq"></i> ' . sprintf( esc_html__( 'Data Rows: %s', 'rank-math' ), '<strong>' . Str::human_number( $db_info['rows'] ) . '</strong>' ) . '</div>',
/* translators: database size */
'<div class="rank-math-console-db-info"><i class="rm-icon rm-icon-database"></i> ' . sprintf( esc_html__( 'Size: %s', 'rank-math' ), '<strong>' . size_format( $db_info['size'] ) . '</strong>' ) . '</div>',
];
}
$actions = as_get_scheduled_actions(
[
'order' => 'DESC',
'hook' => 'rank_math/analytics/data_fetch',
'status' => \ActionScheduler_Store::STATUS_PENDING,
]
);
if ( Authentication::is_authorized() && ! empty( $actions ) ) {
$action = current( $actions );
$schedule = $action->get_schedule();
$next_date = $schedule->get_date();
if ( $next_date ) {
$cmb->add_field(
[
'id' => 'console_data_empty',
'type' => 'raw',
/* translators: date */
'content' => sprintf(
'<span class="next-fetch">' . __( 'Next data fetch on %s', 'rank-math' ),
date_i18n( 'd M, Y H:m:i', $next_date->getTimestamp() ) . '</span>'
),
]
);
}
}
// phpcs:enable
$cmb->add_field(
[
'id' => 'search_console_ui',
'type' => 'raw',
'file' => rank_math()->admin_dir() . '/wizard/views/search-console-ui.php',
]
);
if ( ! Authentication::is_authorized() ) {
return;
}
$is_fetching = 'fetching' === get_option( 'rank_math_analytics_first_fetch' );
$buttons = '<br>' .
'<button class="button button-small console-cache-delete" data-days="-1">' . esc_html__( 'Delete data', 'rank-math' ) . '</button>' .
'&nbsp;&nbsp;<button class="button button-small console-cache-update-manually"' . ( $disable ? ' disabled="disabled"' : '' ) . '>' . ( $is_queue_empty ? esc_html__( 'Update data manually', 'rank-math' ) : esc_html__( 'Fetching in Progress', 'rank-math' ) ) . '</button>' .
'&nbsp;&nbsp;<button class="button button-link-delete button-small cancel-fetch"' . disabled( $is_fetching, false, false ) . '>' . esc_html__( 'Cancel Fetching', 'rank-math' ) . '</button>';
$buttons .= '<br>' . join( '', $db_info );
// Translators: placeholder is a link to rankmath.com, with "free version" as the anchor text.
$description = sprintf( __( 'Enter the number of days to keep Analytics data in your database. The maximum allowed days are 90 in the %s. Though, 2x data will be stored in the DB for calculating the difference properly.', 'rank-math' ), '<a href="' . KB::get( 'pro', 'Analytics DB Option' ) . '" target="_blank" rel="noopener noreferrer">' . __( 'free version', 'rank-math' ) . '</a>' );
$description = apply_filters_deprecated( 'rank_math/analytics/options/cahce_control/description', [ $description ], '1.0.61.1', 'rank_math/analytics/options/cache_control/description' );
$description = apply_filters( 'rank_math/analytics/options/cache_control/description', $description );
$cmb->add_field(
[
'id' => 'console_caching_control',
'type' => 'text',
'name' => __( 'Analytics Database', 'rank-math' ),
// translators: Anchor text 'free version', linking to pricing page.
'description' => $description,
'default' => 90,
'sanitization_cb' => function( $value ) {
$max = apply_filters( 'rank_math/analytics/max_days_allowed', 90 );
$value = absint( $value );
if ( $value > $max ) {
$value = $max;
}
return $value;
},
'after_field' => $buttons,
]
);
$cmb->add_field(
[
'id' => 'analytics_stats',
'type' => 'toggle',
'name' => __( 'Frontend Stats Bar', 'rank-math' ),
'description' => esc_html__( 'Enable this option to show Analytics Stats on the front just after the admin bar.', 'rank-math' ),
'default' => 'on',
]
);
if ( RankMath\Analytics\Email_Reports::are_fields_hidden() ) {
return;
}
$preview_url = home_url( '?rank_math_analytics_report_preview=1' );
$title = esc_html__( 'Email Reports', 'rank-math' );
// Translators: Placeholders are the opening and closing tag for the link.
$description = sprintf( esc_html__( 'Receive periodic SEO Performance reports via email. Once enabled and options are saved, you can see %1$s the preview here%2$s.', 'rank-math' ), '<a href="' . esc_url_raw( $preview_url ) . '" target="_blank">', '</a>' );
$cmb->add_field(
[
'id' => 'email_reports_title',
'type' => 'raw',
'content' => sprintf( '<div class="cmb-form cmb-row nopb"><header class="email-reports-title"><h3>%1$s</h3><p class="description">%2$s</p></header></div>', $title, $description ),
]
);
$cmb->add_field(
[
'id' => 'console_email_reports',
'type' => 'toggle',
'name' => __( 'Email Reports', 'rank-math' ),
'description' => __( 'Turn on email reports.', 'rank-math' ),
'default' => Helper::get_settings( 'general.console_email_reports' ) ? 'on' : 'off',
'classes' => 'nob',
]
);
$is_pro_active = defined( 'RANK_MATH_PRO_FILE' );
$pro_badge = '<span class="rank-math-pro-badge"><a href="' . KB::get( 'seo-email-reporting', 'Email Frequency Toggle' ) . '" target="_blank" rel="noopener noreferrer">' . __( 'PRO', 'rank-math' ) . '</a></span>';
$args = [
'id' => 'console_email_frequency',
'type' => 'select',
'name' => esc_html__( 'Email Frequency', 'rank-math' ) . ( ! $is_pro_active ? $pro_badge : '' ),
'desc' => wp_kses_post( __( 'Email report frequency.', 'rank-math' ) ),
'default' => 'monthly',
'options' => [
'monthly' => esc_html__( 'Every 30 days', 'rank-math' ),
],
'dep' => [ [ 'console_email_reports', 'on' ] ],
'attributes' => ! $is_pro_active ? [ 'disabled' => 'disabled' ] : [],
'before_row' => ! $is_pro_active ? '<div class="cmb-redirector-element" data-url="' . KB::get( 'seo-email-reporting', 'Email Frequency Toggle' ) . '">' : '',
'after_row' => ! $is_pro_active ? '</div>' : '',
];
$cmb->add_field( $args );