File: //proc/self/root/proc/self/root/proc/thread-self/root/var/tmp/phpEao17u
<?php
/*
* SITESEO
* https://siteseo.io
* (c) SiteSEO Team
*/
namespace SiteSEO\Settings;
if(!defined('ABSPATH')){
die('HACKING ATTEMPT!');
}
class Statistics{
static function init(){
global $siteseo;
$current_tab = isset($_GET['tab']) ? sanitize_key(wp_unslash($_GET['tab'])) : 'tab_dashbord';
wp_enqueue_script('siteseo-chart-js', SITESEO_ASSETS_URL . '/js/chart.umd.min.js', [], SITESEO_VERSION, ['strategy' => 'defer', 'in_footer' => true]);
wp_enqueue_script('siteseo-gsc-charts', SITESEO_ASSETS_URL . '/js/gsc-charts.js', ['jquery', 'siteseo-chart-js'], SITESEO_VERSION, ['strategy' => 'defer', 'in_footer' => true]);
$saved_data = get_option('siteseo_search_console_data', []);
wp_localize_script('siteseo-gsc-charts', 'siteseo_chart_data', $saved_data);
if(isset($_GET['siteseo_auth_code']) && class_exists('\SiteSEOPro\GoogleConsole') && method_exists('\SiteSEOPro\GoogleConsole', 'generate_tokens')){
\SiteSEOPro\GoogleConsole::generate_tokens();
}
if(isset($_GET['siteseo_auth_code']) && class_exists('\SiteSEOPro\GoogleConsole')){
add_action('admin_footer', '\SiteSEO\Settings\Statistics::connect_site_dialogbox');
}
$site_connected = false;
if(class_exists('\SiteSEOPro\GoogleConsole') && method_exists('\SiteSEOPro\GoogleConsole', 'is_connected')){
$site_connected = \SiteSEOPro\GoogleConsole::is_connected();
}
$statistics_subtabs = [
'tab_dashbord' => esc_html__('Dashboard', 'siteseo'),
'tab_seo_statistics' => esc_html__('Site Search Traffic', 'siteseo'),
'tab_keyword_rank' => esc_html__('Keyword Rank Tracker', 'siteseo'),
'tab_content_ranking' => esc_html__('Content Ranking', 'siteseo'),
'tab_audience' => esc_html__('Audience Overview', 'siteseo'),
];
echo'<div id="siteseo-root" class="siteseo-search-console">';
Util::admin_header();
$show_sample_data = isset($_GET['sample_data']) && $_GET['sample_data'] === '1';
if(!class_exists('\SiteSEOPro\GoogleConsole') && !$show_sample_data){
echo'<div class="siteseo-blur-overlay"></div>
<div class="siteseo-pro-notice-center">
<div class="siteseo-pro-notice-content">
<span class="dashicons dashicons-lock siteseo-lock-icon"></span>
<h2>'.esc_html__('Search Console Pro Feature', 'siteseo').'</h2>
<p>'.esc_html__('Upgrade to PRO to unlock Google Search Console integration and access real-time search analytics data.', 'siteseo').'</p>
<div class="siteseo-option siteseo-pro-notice-buttons">
<a href="https://siteseo.io/pricing" class="siteseo-option btnPrimary" target="_blank">' . esc_html__('Buy Pro', 'siteseo') . '</a>
<a href="'.esc_url(add_query_arg('sample_data', '1')).'" class="siteseo-option btnSecondary">'.esc_html__('Explore Sample Data', 'siteseo').'</a>
</div>
</div>
</div>';
} elseif(class_exists('\SiteSEOPro\GoogleConsole') && !$show_sample_data && empty($site_connected)){
echo'<div class="siteseo-blur-overlay"></div>
<div class="siteseo-pro-notice-center">
<div class="siteseo-pro-notice-content">
<span class="dashicons dashicons-admin-links siteseo-link-icon"></span>
<h2>'.esc_html__('Search Console statistics', 'siteseo').'</h2>
<p>'.esc_html__('Please connect your Google Search Console account to unlock real-time search analytics data.', 'siteseo').'</p>
<div class="siteseo-option siteseo-pro-notice-buttons">
<form method="post">';
wp_nonce_field('siteseo_pro_connect_google');
echo '<input type="hidden" name="redirect_type" value="settings">
<button type="submit" name="siteseo_pro_connect_btn" class="siteseo-option btnPrimary siteseo-connect-btn">'.esc_html__('Connect Search Console', 'siteseo') .'</button>
</form>
<a href="'.esc_url(add_query_arg('sample_data', '1')).'" class="siteseo-option btnSecondary">'.esc_html__('Explore Sample Data', 'siteseo').'</a>
</div>
</div>
</div>';
}
echo'<form method="post" id="siteseo-form" class="siteseo-option" name="siteseo-flush">
<div class="siteseo-toggle-cnt"><span id="siteseo-tab-title"><strong>'.esc_html__('Google Search Console Statistics', 'siteseo').'</strong></span></div>';
if(!empty($site_connected)){
if(class_exists('\SiteSEOPro\GoogleConsole') && method_exists('\SiteSEOPro\GoogleConsole', 'get_site_url')){
$site_url = \SiteSEOPro\GoogleConsole::get_site_url();
}
if(!empty($site_url)){
echo'<div class="siteseo-statistics-wrapper">
<span class="siteseo-statistics-sites">Site: '.(strpos($site_url, 'sc-domain:') === 0 ? sanitize_text_field($site_url) : esc_url($site_url)).' <span id="siteseo-refresh-search-stats" class="dashicons dashicons-update" title="'.esc_attr__('Update Stats', 'siteseo').'"></span></span>
<span class="siteseo-statistics-disconnect"><span class="dashicons dashicons-migrate"></span>'.esc_html__('Disconnect', 'siteseo').'</span>
<span class="siteseo-statistics-data-range">'.esc_html__('[Last 90 days data]', 'siteseo').'</span>
</div>';
}
}
echo'<div id="siteseo-tabs" class="wrap">
<div class="siteseo-nav-tab-wrapper">';
foreach($statistics_subtabs as $tab_key => $tab_caption){
$active_class = ($current_tab === $tab_key) ? ' siteseo-nav-tab-active' : '';
echo'<a id="' . esc_attr($tab_key) . '-tab" class="siteseo-nav-tab' . esc_attr($active_class) . '" data-tab="' . esc_attr($tab_key) . '">' . esc_html($tab_caption) . '</a>';
}
echo'</div>
<div class="tab-content-wrapper">
<div class="siteseo-tab' .($current_tab == 'tab_dashbord' ? ' active' : '').'" id="tab_dashbord" style="display: none;">';
self::dashbord_tab();
echo'</div>
<div class="siteseo-tab' .($current_tab == 'tab_seo_statistics' ? ' active' : '').'" id="tab_seo_statistics" style="display: none;">';
self::seo_statistics_tab();
echo'</div>
<div class="siteseo-tab' .($current_tab == 'tab_keyword_rank' ? ' active' : '').'" id="tab_keyword_rank" style="display: none;">';
self::keyword_ranking_tab();
echo'</div>
<div class="siteseo-tab' .($current_tab == 'tab_content_ranking' ? ' active' : '').'" id="tab_content_ranking" style="display: none;">';
self::content_ranking_tab();
echo'</div>
<div class="siteseo-tab '.($current_tab =='tab_audience' ? ' active' : '').'" id="tab_audience" style="display:none;">';
self::audience_tab();
echo'</div>
</div>';
echo'</form></div>';
}
static function fetch_data(){
$is_connected = '';
if(class_exists('\SiteSEOPro\GoogleConsole') && method_exists('\SiteSEOPro\GoogleConsole', 'is_connected')){
$is_connected = \SiteSEOPro\GoogleConsole::is_connected();
}
$analytics_data = get_option('siteseo_search_console_data', []);
if(empty($analytics_data) && empty($is_connected)){
// Show sample data when not connected
return [
'metrics' => self::sample_metrics_data(),
'top_pages' => self::sample_top_pages(),
'top_loss_pages' => array_slice(self::sample_top_pages(), 0, 3), // Sample loss pages
'top_winning_pages' => array_slice(self::sample_top_pages(), 3, 3), // Sample winning pages
'keywords' => self::sample_keywords(),
'top_winning_keywords' => array_slice(self::sample_keywords(), 0, 3), // Sample winning keywords
'top_loss_keywords' => array_slice(self::sample_keywords(), 3, 2), // Sample loss keywords
'content_ranking' => self::sample_content_ranking(),
'country_data' => self::sample_country_data(),
'device_data' => self::sample_device_data(),
'is_sample' => true
];
}
return [
'metrics' => isset($analytics_data['metrics']) ? $analytics_data['metrics'] : [
'impressions' => [
'current' => '0',
'change' => '0',
'trend' => 'neutral',
'chart_data' => []
],
'clicks' => [
'current' => '0',
'change' => '0',
'trend' => 'neutral',
'chart_data' => []
],
'ctr' => [
'current' => '0%',
'change' => '0',
'trend' => 'neutral',
'chart_data' => []
],
'position' => [
'current' => '0',
'change' => '0',
'trend' => 'neutral',
'chart_data' => []
]
],
'top_pages' => isset($analytics_data['top_pages']) ? array_slice($analytics_data['top_pages'], 0, 5) : [],
'top_loss_pages' => isset($analytics_data['top_loss_pages']) ? array_slice($analytics_data['top_loss_pages'], 0, 5) : [],
'top_winning_pages' => isset($analytics_data['top_winning_pages']) ? array_slice($analytics_data['top_winning_pages'], 0, 5) : [],
'keywords' => isset($analytics_data['top_keywords']) ? array_slice($analytics_data['top_keywords'], 0, 5) : [],
'top_winning_keywords' => isset($analytics_data['top_winning_keywords']) ? array_slice($analytics_data['top_winning_keywords'], 0, 5) : [],
'top_loss_keywords' => isset($analytics_data['top_loss_keywords']) ? array_slice($analytics_data['top_loss_keywords'], 0, 5) : [],
'content_ranking' => isset($analytics_data['content_ranking']) ? $analytics_data['content_ranking'] : [],
'country_data' => isset($analytics_data['country_audience']) ? $analytics_data['country_audience'] : [],
'device_data' => isset($analytics_data['device_audience']) ? $analytics_data['device_audience'] : [],
'is_sample' => false
];
}
static function dashbord_tab(){
self::connect_notices();
$data = self::fetch_data();
$metrics = $data['metrics'];
$top_pages = $data['top_pages'];
$top_loss_pages = $data['top_loss_pages'];
$top_winning_pages = $data['top_winning_pages'];
$keywords = $data['keywords'];
$top_winning_keywords = $data['top_winning_keywords'];
$top_loss_keywords = $data['top_loss_keywords'];
echo'<div class="siteseo-stats-container">
<h2 class="siteseo-stats-title">'.esc_html__('Search Performance', 'siteseo').'</h2>
<hr class="siteseo-stats-separator">
<div class="siteseo-dashboard-grid">
<div class="siteseo-metric-card">
<div class="siteseo-metric-header">
<span class="siteseo-metric-title">'.esc_html__('Search Impressions', 'siteseo').'</span>
</div>
<div class="siteseo-metric-value-row">
<span class="siteseo-metric-value">'.esc_html($metrics['impressions']['current']).'</span>
<span class="siteseo-metric-change '.($metrics['impressions']['trend'] == 'negative' ? 'siteseo-change-negative' : ($metrics['impressions']['trend'] == 'positive' ? 'siteseo-change-positive' : '')).'">
'.($metrics['impressions']['trend'] != 'neutral' ? '<span class="dashicons dashicons-arrow-'.($metrics['impressions']['trend'] == 'negative' ? 'down' : 'up').'"></span>' : '').'
'.esc_html($metrics['impressions']['change']).'
</span>
</div>
<div class="siteseo-chart-container">
<canvas id="siteseo_impressions_chart" data-sample="'.($data['is_sample'] ? '1' : '0').'"></canvas>
</div>
</div>
<div class="siteseo-metric-card">
<div class="siteseo-metric-header">
<span class="siteseo-metric-title">'.esc_html__('Total Clicks', 'siteseo').'</span>
</div>
<div class="siteseo-metric-value-row">
<span class="siteseo-metric-value">'.esc_html($metrics['clicks']['current']).'</span>
<span class="siteseo-metric-change '.($metrics['clicks']['trend'] == 'negative' ? 'siteseo-change-negative' : ($metrics['clicks']['trend'] == 'positive' ? 'siteseo-change-positive' : '')).'">
'.($metrics['clicks']['trend'] != 'neutral' ? '<span class="dashicons dashicons-arrow-'.($metrics['clicks']['trend'] == 'negative' ? 'down' : 'up').'"></span>' : '').'
'.esc_html($metrics['clicks']['change']).'
</span>
</div>
<div class="siteseo-chart-container">
<canvas id="siteseo_clicks_chart" data-sample="'.($data['is_sample'] ? '1' : '0').'"></canvas>
</div>
</div>
<div class="siteseo-metric-card">
<div class="siteseo-metric-header">
<span class="siteseo-metric-title">'.esc_html__('Avg. CTR', 'siteseo').'</span>
</div>
<div class="siteseo-metric-value-row">
<span class="siteseo-metric-value">'.esc_html($metrics['ctr']['current']).'</span>
<span class="siteseo-metric-change '.($metrics['ctr']['trend'] == 'negative' ? 'siteseo-change-negative' : ($metrics['ctr']['trend'] == 'positive' ? 'siteseo-change-positive' : '')).'">
'.($metrics['ctr']['trend'] != 'neutral' ? '<span class="dashicons dashicons-arrow-'.($metrics['ctr']['trend'] == 'negative' ? 'down' : 'up').'"></span>' : '').'
'.esc_html($metrics['ctr']['change']).'
</span>
</div>
<div class="siteseo-chart-container">
<canvas id="siteseo_ctr_chart" data-sample="'.($data['is_sample'] ? '1' : '0').'"></canvas>
</div>
</div>
<div class="siteseo-metric-card">
<div class="siteseo-metric-header">
<span class="siteseo-metric-title">'.esc_html__('Avg. Position', 'siteseo').'</span>
</div>
<div class="siteseo-metric-value-row">
<span class="siteseo-metric-value">'.esc_html($metrics['position']['current']).'</span>
<span class="siteseo-metric-change '.($metrics['position']['trend'] == 'negative' ? 'siteseo-change-negative' : ($metrics['position']['trend'] == 'positive' ? 'siteseo-change-positive' : '')).'">
'.($metrics['position']['trend'] != 'neutral' ? '<span class="dashicons dashicons-arrow-'.($metrics['position']['trend'] == 'negative' ? 'down' : 'up').'"></span>' : '').'
'.esc_html($metrics['position']['change']).'
</span>
</div>
<div class="siteseo-chart-container">
<canvas id="siteseo_position_chart" data-sample="'.($data['is_sample'] ? '1' : '0').'"></canvas>
</div>
</div>
</div>
</div>';
if(!empty($top_pages) || $data['is_sample']){
echo'<div class="siteseo-stats-container">
<h2 class="siteseo-stats-title">'.esc_html__('Content Performance ( Top 5 )', 'siteseo').'</h2>
<div class="siteseo-inner-tabs-wrap">
<input type="radio" id="siteseo-statistics-top-page" name="siteseo-inner-tabs-pages" checked>
<input type="radio" id="siteseo-statistics-top-loss" name="siteseo-inner-tabs-pages">
<input type="radio" id="siteseo-statistics-top-winning" name="siteseo-inner-tabs-pages">
<ul class="siteseo-inner-tabs">
<li class="siteseo-inner-tab"><label for="siteseo-statistics-top-page">'.esc_html__('Top Pages', 'siteseo').'</label></li>
<li class="siteseo-inner-tab"><label for="siteseo-statistics-top-loss">'.esc_html__('Top loss', 'siteseo').'</label></li>
<li class="siteseo-inner-tab"><label for="siteseo-statistics-top-winning">'.esc_html__('Top winning', 'siteseo').'</label></li>
</ul>
<div class="siteseo-inner-tab-content">
<table class="wp-list-table widefat fixed striped siteseo-history-table">
<thead><tr>
<th>'.esc_html__('Title', 'siteseo').'</th>
<th>'.esc_html__('Score', 'siteseo').'</th>
<th>'.esc_html__('Indexed', 'siteseo').'</th>
<th>'.esc_html__('Clicks', 'siteseo').'</th>
<th>'.esc_html__('Impressions', 'siteseo').'</th>
<th>'.esc_html__('Position', 'siteseo').'</th>
<th>'.esc_html__('Diff', 'siteseo').'</th>
</tr>
</thead>
<tbody>';
foreach($top_pages as $page){
$score = $page['truseo_score'];
if($score >= 80){
$badge_class = 'siteseo-gsc-score-good';
} elseif ($score >= 50){
$badge_class = 'siteseo-gsc-score-avg';
} else{
$badge_class = 'siteseo-gsc-score-bad';
}
echo'<tr>
<td>'.esc_html($page['title']).'</td>
<td><span class="'.esc_attr($badge_class).'">'.esc_html($page['truseo_score']).'/100</span></td>
<td><span class="dashicons '.($page['indexed'] ? 'dashicons-yes-alt siteseo-statistics-index-icon' : 'dashicons-dismiss siteseo-statistics-noindex-icon').'"></span></td>
<td>'.esc_html($page['clicks']).'</td>
<td>'.esc_html($page['impressions']).'</td>
<td>'.esc_html($page['position']).'</td>
<td style="color:'.(isset($page['diff']) && strpos($page['diff'], '+') === 0 ? '#28a745' : '#dc3545').';">'.esc_html($page['diff']).'</td>
</tr>';
}
if(empty($top_pages) && !$data['is_sample']){
echo '<tr><td colspan="7" style="text-align:center;">'.esc_html__('No data available yet', 'siteseo').'</td></tr>';
}
echo'</tbody></table>
</div>
<div class="siteseo-inner-tab-content">
<table class="wp-list-table widefat fixed striped siteseo-history-table">
<thead><tr>
<th>'.esc_html__('Title', 'siteseo').'</th>
<th>'.esc_html__('Score', 'siteseo').'</th>
<th>'.esc_html__('Indexed', 'siteseo').'</th>
<th>'.esc_html__('Clicks', 'siteseo').'</th>
<th>'.esc_html__('Impressions', 'siteseo').'</th>
<th>'.esc_html__('Position', 'siteseo').'</th>
<th>'.esc_html__('Diff', 'siteseo').'</th>
</tr>
</thead>
<tbody>';
// Use top_loss_pages instead of top_pages
foreach($top_loss_pages as $page){
$score = $page['truseo_score'];
if($score >= 80){
$badge_class = 'siteseo-gsc-score-good';
} elseif($score >= 50){
$badge_class = 'siteseo-gsc-score-avg';
} else{
$badge_class = 'siteseo-gsc-score-bad';
}
echo'<tr>
<td>'.esc_html($page['title']).'</td>
<td><span class="'.esc_attr($badge_class).'">'.esc_html($page['truseo_score']).'/100</span></td>
<td><span class="dashicons '.($page['indexed'] ? 'dashicons-yes-alt siteseo-statistics-index-icon' : 'dashicons-dismiss siteseo-statistics-noindex-icon').'"></span></td>
<td>'.esc_html($page['clicks']).'</td>
<td>'.esc_html($page['impressions']).'</td>
<td>'.esc_html($page['position']).'</td>
<td style="color:#dc3545;">'.esc_html($page['diff']).'</td>
</tr>';
}
if(empty($top_loss_pages) && !$data['is_sample']){
echo '<tr><td colspan="7" style="text-align:center;">'.esc_html__('No loss pages data available', 'siteseo').'</td></tr>';
}
echo'</tbody></table>
</div>
<div class="siteseo-inner-tab-content">
<table class="wp-list-table widefat fixed striped siteseo-history-table">
<thead><tr>
<th>'.esc_html__('Title', 'siteseo').'</th>
<th>'.esc_html__('Score', 'siteseo').'</th>
<th>'.esc_html__('Indexed', 'siteseo').'</th>
<th>'.esc_html__('Clicks', 'siteseo').'</th>
<th>'.esc_html__('Impressions', 'siteseo').'</th>
<th>'.esc_html__('Position', 'siteseo').'</th>
<th>'.esc_html__('Diff', 'siteseo').'</th>
</tr>
</thead>
<tbody>';
// Use top_winning_pages instead of top_pages
foreach($top_winning_pages as $page){
$score = $page['truseo_score'];
if($score >= 80){
$badge_class = 'siteseo-gsc-score-good';
} elseif($score >= 50){
$badge_class = 'siteseo-gsc-score-avg';
} else{
$badge_class = 'siteseo-gsc-score-bad';
}
echo'<tr>
<td>'.esc_html($page['title']).'</td>
<td><span class="'.esc_attr($badge_class).'">'.esc_html($page['truseo_score']).'/100</span></td>
<td><span class="dashicons '.($page['indexed'] ? 'dashicons-yes-alt siteseo-statistics-index-icon' : 'dashicons-dismiss siteseo-statistics-noindex-icon').'"></span></td>
<td>'.esc_html($page['clicks']).'</td>
<td>'.esc_html($page['impressions']).'</td>
<td>'.esc_html($page['position']).'</td>
<td style="color:#28a745;">'.esc_html($page['diff']).'</td>
</tr>';
}
if(empty($top_winning_pages) && !$data['is_sample']){
echo '<tr><td colspan="7" style="text-align:center;">'.esc_html__('No winning pages data available', 'siteseo').'</td></tr>';
}
echo'</tbody></table>
</div>
</div>
</div>';
}
if(!empty($keywords) || $data['is_sample']){
echo'<div class="siteseo-stats-container">
<h2 class="siteseo-stats-title">'.esc_html__('Keyword Rankings ( Top 5 )', 'siteseo').'</h2>
<div class="siteseo-inner-tabs-wrap">
<input type="radio" id="siteseo-statistics-top-keywords" name="siteseo-inner-tabs-keywords" checked>
<input type="radio" id="siteseo-statistics-winning-keywords" name="siteseo-inner-tabs-keywords">
<input type="radio" id="siteseo-statistics-loss-keywords" name="siteseo-inner-tabs-keywords">
<ul class="siteseo-inner-tabs">
<li class="siteseo-inner-tab"><label for="siteseo-statistics-top-keywords">'.esc_html__('Top Keywords', 'siteseo').'</label></li>
<li class="siteseo-inner-tab"><label for="siteseo-statistics-winning-keywords">'.esc_html__('Top Winning', 'siteseo').'</label></li>
<li class="siteseo-inner-tab"><label for="siteseo-statistics-loss-keywords">'.esc_html__('Top LOSS', 'siteseo').'</label></li>
</ul>
<div class="siteseo-inner-tab-content">
<table class="wp-list-table widefat fixed striped siteseo-history-table">
<thead>
<tr>
<th>'.esc_html__('Keyword', 'siteseo').'</th>
<th>'.esc_html__('Clicks', 'siteseo').'</th>
<th>'.esc_html__('Impressions', 'siteseo').'</th>
<th>'.esc_html__('CTR', 'siteseo').'</th>
<th>'.esc_html__('Position', 'siteseo').'</th>
</tr>
</thead>
<tbody>';
foreach($keywords as $keyword){
echo'<tr>
<td class="siteseo-table-row">'.esc_html($keyword['keyword']).'</td>
<td style="font-weight:bold;">'.esc_html($keyword['clicks']).'</td>
<td>'.esc_html($keyword['impressions']).'</td>
<td>'.esc_html($keyword['ctr']).'</td>
<td>'.esc_html($keyword['position']).'</td>
</tr>';
}
if(empty($keywords) && !$data['is_sample']){
echo'<tr><td colspan="5" style="text-align:center;">'.esc_html__('No data available yet', 'siteseo').'</td></tr>';
}
echo'</tbody>
</table>
</div>
<div class="siteseo-inner-tab-content">
<table class="wp-list-table widefat fixed striped siteseo-history-table">
<thead>
<tr>
<th>'.esc_html__('Keyword', 'siteseo').'</th>
<th>'.esc_html__('Points', 'siteseo').'</th>
<th>'.esc_html__('Clicks', 'siteseo').'</th>
<th>'.esc_html__('Position', 'siteseo').'</th>
</tr>
</thead>
<tbody>';
// Use top_winning_keywords instead of keywords
foreach($top_winning_keywords as $keyword){
echo'<tr>
<td class="siteseo-table-row">'.esc_html($keyword['keyword']).'</td>
<td style="color:#28a745;font-weight:bold;">'.esc_html($keyword['points']).'</td>
<td>'.esc_html($keyword['clicks']).'</td>
<td>'.esc_html($keyword['position']).'</td>
</tr>';
}
if(empty($top_winning_keywords) && !$data['is_sample']){
echo'<tr><td colspan="4" style="text-align:center;">'.esc_html__('No winning keywords data available', 'siteseo').'</td></tr>';
}
echo'</tbody>
</table>
</div>
<div class="siteseo-inner-tab-content">
<table class="wp-list-table widefat fixed striped siteseo-history-table">
<thead>
<tr>
<th>'.esc_html__('Keyword', 'siteseo').'</th>
<th>'.esc_html__('Points', 'siteseo').'</th>
<th>'.esc_html__('Clicks', 'siteseo').'</th>
<th>'.esc_html__('Position', 'siteseo').'</th>
</tr>
</thead>
<tbody>';
// Use top_loss_keywords instead of keywords
foreach($top_loss_keywords as $keyword){
echo'<tr>
<td class="siteseo-table-row">'.esc_html($keyword['keyword']).'</td>
<td style="color:#dc3545;font-weight:bold;">'.esc_html($keyword['points']).'</td>
<td>'.esc_html($keyword['clicks']).'</td>
<td>'.esc_html($keyword['position']).'</td>
</tr>';
}
if(empty($top_loss_keywords) && !$data['is_sample']){
echo'<tr><td colspan="4" style="text-align:center;">'.esc_html__('No loss keywords data available', 'siteseo').'</td></tr>';
}
echo'</tbody>
</table>
</div>
</div>
</div>';
}
}
static function seo_statistics_tab(){
self::connect_notices();
$data = self::fetch_data();
$metrics = $data['metrics'];
$top_pages = $data['top_pages'];
echo'<div class="siteseo-stats-container">
<h2 class="siteseo-stats-title">'.esc_html__('Site Search Traffic', 'siteseo').'</h2>
<hr class="siteseo-stats-separator">
<ul class="siteseo-stats-list">
<li class="siteseo-stat-item">
<div class="siteseo-stat-header">
<span class="siteseo-stat-label">'.esc_html__('Search Impressions', 'siteseo').'</span>
</div>
<div class="siteseo-stat-value-group">
<span class="siteseo-stat-value">'.esc_html($metrics['impressions']['current']).'</span>
<span class="siteseo-stat-change '.($metrics['impressions']['trend'] == 'negative' ? 'negative' : ($metrics['impressions']['trend'] == 'positive' ? 'positive' : '')).'">
'.($metrics['impressions']['trend'] != 'neutral' ? '<span class="dashicons dashicons-arrow-'.($metrics['impressions']['trend'] == 'negative' ? 'down' : 'up').'"></span>' : '').'
'.esc_html($metrics['impressions']['change']).'
</span>
</div>
</li>
<li class="siteseo-stat-item">
<div class="siteseo-stat-header">
<span class="siteseo-stat-label">'.esc_html__('Total Clicks', 'siteseo').'</span>
</div>
<div class="siteseo-stat-value-group">
<span class="siteseo-stat-value">'.esc_html($metrics['clicks']['current']).'</span>
<span class="siteseo-stat-change '.($metrics['clicks']['trend'] == 'negative' ? 'negative' : ($metrics['clicks']['trend'] == 'positive' ? 'positive' : '')).'">
'.($metrics['clicks']['trend'] != 'neutral' ? '<span class="dashicons dashicons-arrow-'.($metrics['clicks']['trend'] == 'negative' ? 'down' : 'up').'"></span>' : '').'
'.esc_html($metrics['clicks']['change']).'
</span>
</div>
</li>
<li class="siteseo-stat-item">
<div class="siteseo-stat-header">
<span class="siteseo-stat-label">'.esc_html__('Avg. CTR', 'siteseo').'</span>
</div>
<div class="siteseo-stat-value-group">
<span class="siteseo-stat-value">'.esc_html($metrics['ctr']['current']).'</span>
<span class="siteseo-stat-change '.($metrics['ctr']['trend'] == 'negative' ? 'negative' : ($metrics['ctr']['trend'] == 'positive' ? 'positive' : '')).'">
'.($metrics['ctr']['trend'] != 'neutral' ? '<span class="dashicons dashicons-arrow-'.($metrics['ctr']['trend'] == 'negative' ? 'down' : 'up').'"></span>' : '').'
'.esc_html($metrics['ctr']['change']).'
</span>
</div>
</li>
<li class="siteseo-stat-item">
<div class="siteseo-stat-header">
<span class="siteseo-stat-label">'.esc_html__('Avg. Position.', 'siteseo').'</span>
</div>
<div class="siteseo-stat-value-group">
<span class="siteseo-stat-value">'.esc_html($metrics['position']['current']).'</span>
<span class="siteseo-stat-change '.($metrics['position']['trend'] == 'negative' ? 'negative' : ($metrics['position']['trend'] == 'positive' ? 'positive' : '')) . '">
'.($metrics['position']['trend'] != 'neutral' ? '<span class="dashicons dashicons-arrow-' . ($metrics['position']['trend'] == 'negative' ? 'down' : 'up') . '"></span>' : ''
) . '
'.esc_html($metrics['position']['change']).'
</span>
</div>
</li>
</ul>
<canvas id="seo_statistics" width="950" height="250" data-sample="'.($data['is_sample'] ? '1' : '0').'"></canvas>
</div>';
if(!empty($top_pages) || $data['is_sample']){
echo'<div class="siteseo-stats-container">
<h2 class="siteseo-stats-title">'.esc_html__('Content Analysis ( Top 5 )', 'siteseo').'</h2>
<table class="wp-list-table widefat fixed striped siteseo-history-table">
<thead><tr>
<th>'.esc_html__('Page', 'siteseo').'</th>
<th>'.esc_html__('Status', 'siteseo').'</th>
<th>'.esc_html__('Clicks', 'siteseo').'</th>
<th>'.esc_html__('Avg position', 'siteseo').'</th>
<th>'.esc_html__('Impressions', 'siteseo').'</th>
<th>'.esc_html__('Content Score', 'siteseo').'</th>
</tr>
</thead>
<tbody>';
foreach($top_pages as $page){
$score = $page['truseo_score'];
if($score >= 80){
$badge_class = 'siteseo-gsc-score-good';
} elseif ($score >= 50){
$badge_class = 'siteseo-gsc-score-avg';
} else{
$badge_class = 'siteseo-gsc-score-bad';
}
echo'<tr>
<td>'.esc_html($page['title']).'</td>
<td>'.(isset($page['indexed']) ? ($page['indexed'] ? '<span class="dashicons dashicons-yes-alt" style="color:#28a745;"></span>' : '<span class="dashicons dashicons-dismiss" style="color:#dc3545;"></span>') : '<span class="dashicons dashicons-editor-help" style="color:#6c757d;"></span>').'</td>
<td>'.esc_html($page['clicks']).'</td>
<td>'.esc_html($page['position']).'</td>
<td>'.esc_html($page['impressions']).'</td>
<td><span class="'.esc_attr($badge_class).'">'.esc_html($page['truseo_score']).'/100</span></td>
</tr>';
}
if(empty($top_pages) && !$data['is_sample']){
echo'<tr><td colspan="6" style="text-align:center;">'.esc_html__('No data available yet', 'siteseo').'</td></tr>';
}
echo'</tbody></table>
</div>';
}
}
static function keyword_ranking_tab(){
self::connect_notices();
$data = self::fetch_data();
$keywords = $data['keywords'];
// Get actual analytics data if available
$analytics_data = get_option('siteseo_search_console_data', []);
$has_actual_data = !empty($analytics_data) && !isset($analytics_data['error']);
// Prepare values based on actual data or sample
if($has_actual_data && !$data['is_sample']){
// Use actual data
$total_keywords = isset($analytics_data['top_keywords']) ? count($analytics_data['top_keywords']) : 0;
$total_impressions = isset($analytics_data['metrics']['impressions']['current']) ? $analytics_data['metrics']['impressions']['current'] : '0';
$avg_ctr = isset($analytics_data['metrics']['ctr']['current']) ? $analytics_data['metrics']['ctr']['current'] : '0%';
$impression_change = isset($analytics_data['metrics']['impressions']['change']) ? $analytics_data['metrics']['impressions']['change'] : '0';
$impression_trend = isset($analytics_data['metrics']['impressions']['trend']) ? $analytics_data['metrics']['impressions']['trend'] : 'neutral';
$ctr_change = '0';
$ctr_trend = 'neutral';
} else{
// Use sample data or zeros
$total_keywords = $data['is_sample'] ? '19K' : '0';
$total_impressions = $data['is_sample'] ? '15M' : '0';
$avg_ctr = $data['is_sample'] ? '48.25%' : '0%';
$impression_change = $data['is_sample'] ? '475.7K' : '0';
$impression_trend = $data['is_sample'] ? 'negative' : 'neutral';
$ctr_change = $data['is_sample'] ? '1' : '0';
$ctr_trend = $data['is_sample'] ? 'negative' : 'neutral';
}
echo'<div class="siteseo-stats-container">
<h2 class="siteseo-stats-title">'.esc_html__('Keyword Positions', 'siteseo').'</h2>
<hr class="siteseo-stats-separator">
<ul class="siteseo-stats-list">
<li class="siteseo-stat-item">
<div class="siteseo-stat-header">
<span class="siteseo-stat-label">'.esc_html__('Total Keyword', 'siteseo').'</span>
</div>
<div class="siteseo-stat-value-group">
<span class="siteseo-stat-value">'.esc_html($total_keywords).'</span>
'.($data['is_sample'] ? '<span class="siteseo-stat-change positive">
<span class="dashicons dashicons-arrow-up"></span>2.9K
</span>' : '').'
</div>
</li>
<li class="siteseo-stat-item">
<div class="siteseo-stat-header">
<span class="siteseo-stat-label">'.esc_html__('Search Impressions', 'siteseo').'</span>
</div>
<div class="siteseo-stat-value-group">
<span class="siteseo-stat-value">'.esc_html($total_impressions).'</span>
'.((!$data['is_sample'] && $has_actual_data) ?
'<span class="siteseo-stat-change '.esc_attr($impression_trend).'">
<span class="dashicons dashicons-arrow-'.($impression_trend === 'positive' ? 'up' : 'down').'"></span>'
.esc_html($impression_change).'
</span>' :
($data['is_sample'] ?
'<span class="siteseo-stat-change negative">
<span class="dashicons dashicons-arrow-down"></span>475.7K
</span>' : '')).'
</div>
</li>
<li class="siteseo-stat-item">
<div class="siteseo-stat-header">
<span class="siteseo-stat-label">'.esc_html__('Avg. CTR', 'siteseo').'</span>
</div>
<div class="siteseo-stat-value-group">
<span class="siteseo-stat-value">'.esc_html($avg_ctr).'</span>
'.($data['is_sample'] ?
'<span class="siteseo-stat-change negative">
<span class="dashicons dashicons-arrow-down"></span>1
</span>' : '').'
</div>
</li>
</ul>
<div style="display:flex; gap:20px; flex-wrap:wrap;">
<div style="flex:1; min-width:280px; max-width:50%;">
<canvas id="siteseo_keyword_muti_line_chart" data-sample="'.($data['is_sample'] ? '1' : '0').'" data-actual="'.($has_actual_data ? '1' : '0').'"></canvas>
</div>
<div style="flex:1; min-width:280px; max-width:50%;">
<canvas id="siteseo_keyword_bar_chart" data-sample="'.($data['is_sample'] ? '1' : '0').'" data-actual="'.($has_actual_data ? '1' : '0').'"></canvas>
</div>
</div>
</div>';
if(!empty($keywords) || $data['is_sample']){
echo'<div class="siteseo-stats-container">
<h2 class="siteseo-stats-title">'.esc_html__('Content Analysis ( Top 5 )', 'siteseo').'</h2>
<table class="wp-list-table widefat fixed striped siteseo-history-table">
<thead><tr>
<th>'.esc_html__('Keywords', 'siteseo').'</th>
<th>'.esc_html__('Clicks', 'siteseo').'</th>
<th>'.esc_html__('Avg. CTR', 'siteseo').'</th>
<th>'.esc_html__('Impressions', 'siteseo').'</th>
<th>'.esc_html__('Position', 'siteseo').'</th>
</tr>
</thead>
<tbody>';
foreach($keywords as $keyword){
echo'<tr>
<td class="siteseo-table-row">'.esc_html($keyword['keyword']).'</td>
<td>'.esc_html($keyword['clicks']).'</td>
<td>'.esc_html($keyword['ctr']).'</td>
<td>'.esc_html($keyword['impressions']).'</td>
<td>'.esc_html($keyword['position']).'</td>
</tr>';
}
if(empty($keywords) && !$data['is_sample']){
echo'<tr><td colspan="6" style="text-align:center;">'.esc_html__('No data available yet', 'siteseo').'</td></tr>';
}
echo'</tbody></table>
</div>';
}
}
static function content_ranking_tab(){
self::connect_notices();
$data = self::fetch_data();
$content_ranking = $data['content_ranking'];
if(!empty($content_ranking) || $data['is_sample']){
// Pagination setup
$items_per_page = 10;
$total_items = count($content_ranking);
$total_pages = ceil($total_items / $items_per_page);
$current_page = isset($_GET['cr_page']) ? max(1, intval($_GET['cr_page'])) : 1;
$offset = ($current_page - 1) * $items_per_page;
$paged_items = array_slice($content_ranking, $offset, $items_per_page);
echo'<div class="siteseo-stats-container">
<h2 class="siteseo-stats-title">'.esc_html__('Content Analysis (Top 30)', 'siteseo').'</h2>
<table class="wp-list-table widefat fixed striped siteseo-history-table">
<thead><tr>
<th>'.esc_html__('Title', 'siteseo').'</th>
<th>'.esc_html__('Indexed', 'siteseo').'</th>
<th>'.esc_html__('Last Update on', 'siteseo').'</th>
<th>'.esc_html__('Loss', 'siteseo').'</th>
<th>'.esc_html__('Drop (%)', 'siteseo').'</th>
<th>'.esc_html__('Performance Score', 'siteseo').'</th>
</tr>
</thead>
<tbody>';
foreach($paged_items as $content){
$score = (int) explode('/', $content['performance_score'])[0];
if($score >= 80){
$badge_class = 'siteseo-gsc-score-good';
} elseif($score >= 50){
$badge_class = 'siteseo-gsc-score-avg';
} else{
$badge_class = 'siteseo-gsc-score-bad';
}
echo'<tr>
<td>'.esc_html($content['title']).'</td>
<td><span class="dashicons '.($content['indexed'] === 'Yes' ? 'dashicons-yes-alt siteseo-statistics-index-icon' : 'dashicons-dismiss siteseo-statistics-noindex-icon').'"></span></td>
<td>'.esc_html($content['last_update']).'</td>
<td style="color:#dc3545;">'.esc_html($content['loss']).'</td>
<td style="color:#dc3545;">'.esc_html($content['drop_percent']).'</td>
<td><span class="'.esc_attr($badge_class).'">'.esc_html($content['performance_score']).'</span></td>
</tr>';
}
if(empty($content_ranking) && !$data['is_sample']){
echo'<tr><td colspan="6" style="text-align:center;">'.esc_html__('No data available yet', 'siteseo').'</td></tr>';
}
echo'</tbody></table>';
// Pagination controls
if($total_pages > 1){
echo'<div class="siteseo-pagination" style="margin-top: 20px; text-align: center;">';
// Previous btn
if($current_page > 1){
echo'<a href="'.esc_url(add_query_arg('cr_page', $current_page - 1)).'" class="siteseo-option btnSecondary">'.esc_html__('Previous', 'siteseo').'</a> ';
}
// Page numbers
for($i = 1; $i <= $total_pages; $i++){
if($i == $current_page){
echo'<span class="siteseo-option btnSecondary" style="margin: 0 2px;">'.esc_html($i).'</span> ';
} else{
echo'<a href="'.esc_url(add_query_arg('cr_page', $i)).'" class="siteseo-option btnSecondary" style="margin: 0 2px;">'.esc_html($i).'</a> ';
}
}
// Next btn
if($current_page < $total_pages){
echo'<a href="'.esc_url(add_query_arg('cr_page', $current_page + 1)).'" class="siteseo-option btnSecondary">'.esc_html__('Next', 'siteseo').'</a>';
}
echo'</div>';
}
echo'</div>';
}
}
static function audience_tab(){
self::connect_notices();
$data = self::fetch_data();
$country_data = $data['country_data'];
$device_data = $data['device_data'];
echo'<div class="siteseo-audience-statisc">
<div class="siteseo-stats-container">
<h2 class="siteseo-stat-title">'.esc_html__('Device breakdown', 'siteseo').'</h2>
<hr class="siteseo-stats-separator">
<canvas id="siteseo_device_statics" height="250px" width="520px" data-sample="'.($data['is_sample'] ? '1' : '0').'"></canvas>
</div>
<div class="siteseo-stats-container">
<h2 class="siteseo-stats-title">'.esc_html__('Top countries by click ( Top 5 )', 'siteseo').'</h2>
<hr class="siteseo-stats-separator">
<canvas id="siteseo_country_statics" height="300px" width="520px" data-sample="'.($data['is_sample'] ? '1' : '0').'"></canvas>
</div>
</div>';
if(!empty($device_data) || $data['is_sample']){
echo'<div class="siteseo-stats-container">
<h2 class="siteseo-stats-title">'.esc_html__('Device Performance', 'siteseo').'</h2>
<table class="wp-list-table widefat fixed striped siteseo-history-table">
<thead><tr>
<th>'.esc_html__('Device', 'siteseo').'</th>
<th>'.esc_html__('Clicks', 'siteseo').'</th>
<th>'.esc_html__('Impressions', 'siteseo').'</th>
</tr>
</thead>
<tbody>';
foreach($device_data as $data){
echo'<tr>
<td style="font-weight:bold;">'.esc_html( is_array($data['device']) ? implode(', ', $data['device']) : $data['device']).'</td>
<td>'.esc_html($data['clicks']).'</td>
<td>'.esc_html($data['impressions']).'</td>
</tr>';
}
echo'</tbody></table>
</div>';
}
if(!empty($country_data) || $data['is_sample']){
echo'<div class="siteseo-stats-container">
<h2 class="siteseo-stats-title">'.esc_html__('Country Performance ( Top 5 )', 'siteseo').'</h2>
<table class="wp-list-table widefat fixed striped siteseo-history-table">
<thead><tr>
<th>'.esc_html__('Country', 'siteseo').'</th>
<th>'.esc_html__('Clicks', 'siteseo').'</th>
<th>'.esc_html__('Impressions', 'siteseo').'</th>
</tr>
</thead>
<tbody>';
foreach($country_data as $data){
echo '<tr>
<td style="font-weight:bold;">'.esc_html($data['country']).'</td>
<td>'.esc_html($data['clicks']).'</td>
<td>'.esc_html($data['impressions']).'</td>
</tr>';
}
echo'</tbody></table>
</div>';
}
}
static function connect_notices(){
$analytics_data = '';
$gsc_connected = '';
if(class_exists('\SiteSEOPro\GoogleConsole') && method_exists('\SiteSEOPro\GoogleConsole', 'is_connected')){
$analytics_data = get_option('siteseo_search_console_data', []);
$gsc_connected = \SiteSEOPro\GoogleConsole::is_connected();
}
if(empty($gsc_connected)){
echo'<div class="siteseo-notice is-warning"><p>'.wp_kses_post(__('The data shown here is only a <strong> sample from Google Analytics</strong> how SiteSEO will display your site\'s analytics once connected.', 'siteseo')).'</p>';
if(class_exists('\SiteSEOPro\GoogleConsole')){
echo'<form method="post">';
wp_nonce_field('siteseo_pro_connect_google');
echo '<input type="hidden" name="redirect_type" value="settings">
<button type="submit" name="siteseo_pro_connect_btn" class="siteseo-statistics-connect-btn">'.esc_html__('Connect Search Console', 'siteseo') .'</button>
</form>';
} else{
echo'<a href="https://siteseo.io/pricing" class="siteseo-statistics-connect-btn" target="_blank">'.esc_html__('Buy Pro', 'siteseo').'</a>';
}
echo'</div>';
} elseif(empty($analytics_data['top_pages']) && !empty($gsc_connected)){
echo '<div class="siteseo-notice is-info"><p>'.wp_kses_post(__('Connected to Google Search Console. If this is your first time connecting the site and data doesnāt appear yet, please waitāGoogle may take a few days to populate the data. You can also try refreshing.', 'siteseo')).'</p></div>';
}
}
static function sample_device_data(){
return [
[
'device' => 'Mobile',
'clicks' => '48k',
'impressions' => '285k',
'ctr' => '5.2%',
],
[
'device' => 'Desktop',
'clicks' => '70k',
'impressions' => '196k',
'ctr' => '3.8%',
],
[
'device' => 'Tablet',
'clicks' => '10k',
'impressions' => '185k',
'ctr' => '8.1%',
],
];
}
static function sample_country_data(){
return [
[
'country' => 'India',
'clicks' => '8K',
'impressions' => '154K',
'ctr' => '5.2%',
],
[
'country' => 'Poland',
'clicks' => '5K',
'impressions' => '132K',
'ctr' => '3.8%',
],
[
'country' => 'South Africa',
'clicks' => '15K',
'impressions' => '185k',
'ctr' => '8.1%',
],
[
'country' => 'Russia',
'clicks' => '19K',
'impressions' => '200k',
'ctr' => '9.5%',
],
[
'country' => 'United kingdom',
'clicks' => '12K',
'impressions' => '150k',
'ctr' => '5.5%',
],
];
}
static function sample_metrics_data(){
return [
'impressions' => [
'current' => '15M',
'change' => '-475.7K',
'trend' => 'negative',
'chart_data' => [12, 19, 3, 5, 2, 3, 10, 8, 12, 14, 13, 15]
],
'clicks' => [
'current' => '111.5K',
'change' => '+1.7K',
'trend' => 'positive',
'chart_data' => [7, 11, 5, 8, 3, 7, 4, 5, 6, 7, 6, 8]
],
'ctr' => [
'current' => '0.74%',
'change' => '+0.03%',
'trend' => 'positive',
'chart_data' => [0.5, 0.6, 0.7, 0.65, 0.75, 0.7, 0.6, 0.7, 0.72, 0.74, 0.73, 0.75]
],
'position' => [
'current' => '49',
'change' => '+1',
'trend' => 'negative',
'chart_data' => [55, 50, 45, 50, 48, 52, 55, 50, 49, 47, 48, 49]
]
];
}
static function sample_top_pages(){
return [
[
'title' => '/blog/',
'truseo_score' => '95',
'indexed' => true,
'clicks' => '4.5K',
'impressions' => '57.2K',
'position' => '23',
'diff' => '+2'
],
[
'title' => '/contact-us/',
'truseo_score' => '88',
'indexed' => false,
'clicks' => '1.2K',
'impressions' => '1.2M',
'position' => '40',
'diff' => '-5'
],
[
'title' => '/support/',
'truseo_score' => '92',
'indexed' => false,
'clicks' => '15K',
'impressions' => '1.9M',
'position' => '16',
'diff' => '+3'
],
[
'title' => '/pricing/',
'truseo_score' => '85',
'indexed' => true,
'clicks' => '8.7K',
'impressions' => '890K',
'position' => '12',
'diff' => '+1'
],
[
'title' => '/features/',
'truseo_score' => '90',
'indexed' => true,
'clicks' => '12.3K',
'impressions' => '1.5M',
'position' => '8',
'diff' => '+4'
]
];
}
static function sample_keywords(){
return [
[
'keyword' => 'One click seo plugin',
'clicks' => '8K',
'ctr' => '5.2%',
'impressions' => '154K',
'position' => '3',
'trend' => 'up',
'points' => '90'
],
[
'keyword' => 'wordpress seo',
'clicks' => '5K',
'ctr' => '3.8%',
'impressions' => '132K',
'position' => '7',
'trend' => 'up',
'points' => '80'
],
[
'keyword' => 'best seo plugin plugin',
'clicks' => '15K',
'ctr' => '8.1%',
'impressions' => '185K',
'position' => '2',
'trend' => 'up',
'points' => '85'
],
[
'keyword' => 'seo optimization',
'clicks' => '3.2K',
'ctr' => '2.1%',
'impressions' => '152K',
'position' => '15',
'trend' => 'down',
'points' => '88'
],
[
'keyword' => 'website ranking',
'clicks' => '6.8K',
'ctr' => '4.5%',
'impressions' => '151K',
'position' => '5',
'trend' => 'up',
'points' => '70'
]
];
}
static function sample_content_ranking(){
return [
[
'title' => 'Ultimate SEO Guide 2024',
'indexed' => 'Yes',
'last_update' => '2024-01-15',
'loss' => '2.1K',
'drop_percent' => '5.2%',
'performance_score' => '88'
],
[
'title' => 'WordPress Optimization Tips',
'indexed' => 'Yes',
'last_update' => '2024-01-10',
'loss' => '1.5K',
'drop_percent' => '3.8%',
'performance_score' => '92'
],
[
'title' => 'Mobile SEO Strategies',
'indexed' => 'No',
'last_update' => '2024-01-08',
'loss' => '3.2K',
'drop_percent' => '8.1%',
'performance_score' => '75'
],
[
'title' => 'Content Marketing Guide',
'indexed' => 'Yes',
'last_update' => '2024-01-12',
'loss' => '0.8K',
'drop_percent' => '2.1%',
'performance_score' => '95'
]
];
}
static function connect_site_dialogbox(){
$gsc_sites = '';
$current_site_url = trailingslashit(get_site_url());
if(class_exists('\SiteSEOPro\GSCSetup') && method_exists('\SiteSEOPro\GSCSetup', 'get_pre_connected_sites')){
$gsc_sites = \SiteSEOPro\GSCSetup::get_pre_connected_sites();
}
$current_site_exists = false;
if(!empty($gsc_sites) && !isset($gsc_sites['error'])){
foreach($gsc_sites as $site){
if($site['siteUrl'] === $current_site_url){
$current_site_exists = true;
break;
}
}
}
echo'<div id="siteseo-site-connection-dialog" title="'.esc_attr__('Connect site search console', 'siteseo').'" style="display:none;">
<div class="siteseo-dialog-content">';
echo'<div id="siteseo-main-section">';
if($current_site_exists){
// Tab: Current Site
echo'<div class="siteseo-option-primary" style="margin-bottom:20px;">
<p style="color:#1d2327;font-weight:400;font-size:14px;">'.esc_html__('This site is already in your Google Search Console account.', 'siteseo').'</p>
<div class="siteseo-form-group">
<input type="text" id="siteseo-site-url" value="' . esc_attr($current_site_url) . '" class="regular-text" readonly
style="width:100%;padding:8px;background:#f6f7f7;border:1px solid #8c8f94;color:#666;cursor:not-allowed;" />
</div>
<div class="siteseo-dialog-actions">
<button type="button" class="button button-primary siteseo-action-btn" id="siteseo-connect-existing">'.esc_html__('Connect', 'siteseo').'</button>
<span class="spinner"></span>
</div>
</div>';
if(!empty($gsc_sites)){
echo '<div class="siteseo-option-secondary">
<button type="button" class="button button-link" id="siteseo-show-existing-properties" style="width:100%;text-decoration:none;">'.esc_html__('Select from existing sites', 'siteseo').'</button>
</div>';
}
} else{
// Not connected yet
echo'<div class="siteseo-option-primary" style="margin-bottom:20px;">
<p style="color:#1d2327;font-weight:400;font-size:14px;">'.esc_html__('This domain isn\'t yet connected to Google Search Console.', 'siteseo').'</p>
<div class="siteseo-form-group">
<input type="text" id="siteseo-new-domain-url" value="' . esc_attr($current_site_url) . '" class="regular-text" readonly
style="width:100%;padding:8px;background:#f6f7f7;border:1px solid #8c8f94;color:#666;cursor:not-allowed;" />
</div>
<button type="button" class="button button-primary siteseo-action-btn siteseo-create-btn" id="siteseo-create-gsc-property" style="margin-bottom:10px;">'.esc_html__('Connect New Domain', 'siteseo').'</button>
<span class="spinner"></span>
</div>';
if(!empty($gsc_sites)){
echo'<div class="siteseo-option-secondary">
<button type="button" class="button button-link" id="siteseo-show-existing-properties" style="width:100%;text-decoration:none;">'.esc_html__('Connect with existing properties', 'siteseo').'</button>
</div>';
}
}
echo'</div>';
if(!empty($gsc_sites) && !isset($gsc_sites['error'])){
echo'<div id="siteseo-existing-properties-section" style="display:none;">
<p style="color:#1d2327;font-weight:400;font-size:14px;">'. esc_html__('Select an existing site from your Google Search Console account.', 'siteseo').'</p>
<div class="siteseo-form-group">
<select id="siteseo-site-url" name="existing_site_url" class="siteseo-select-box">';
foreach($gsc_sites as $site){
echo'<option value="'.esc_attr($site['siteUrl']).'">'.esc_html($site['siteUrl']).'</option>';
}
echo'</select>
</div>
<div class="siteseo-dialog-actions">
<button type="button" class="button button-secondary siteseo-action-btn" id="siteseo-back-to-main">'.esc_html__('Back', 'siteseo').'</button>
<button type="button" class="button button-primary siteseo-action-btn" id="siteseo-connect-existing">'.esc_html__('Connect', 'siteseo').'</button>
<span class="spinner" style="margin-top:7px;"></span>
</div>
</div>';
}
echo'</div></div>'; // End dialog content + wrapper
}
}
<?php
/*
* SITESEO
* https://siteseo.io
* (c) SiteSEO Team
*/
namespace SiteSEO\Settings;
if(!defined('ABSPATH')){
die('HACKING ATTEMPT!');
}
class Titles{
static function menu(){
global $siteseo;
$current_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'tab_siteseo_home'; // Default tab
$titles_meta_subtabs = [
'tab_siteseo_home' => esc_html__('Home', 'siteseo'),
'tab_siteseo_post_types' => esc_html__('Post types', 'siteseo'),
'tab_siteseo_archives' => esc_html__('Archives', 'siteseo'),
'tab_siteseo_taxonomies' => esc_html__('Taxonomies', 'siteseo'),
'tab_siteseo_advanced' => esc_html__('Advanced','siteseo')
];
echo '<div id="siteseo-root">';
Util::admin_header();
echo '<form method="post" id="siteseo-form" class="siteseo-option" name="siteseo-flush">';
wp_nonce_field('siteseo_title_settings');
$titles_meta_toggle = isset($siteseo->setting_enabled['toggle-titles']) ? $siteseo->setting_enabled['toggle-titles'] : '';
$nonce = wp_create_nonce('siteseo_toggle_nonce');
Util::render_toggle('Titles & Metas - SiteSEO', 'titles_meta_toggle', $titles_meta_toggle, $nonce);
echo '<div id="siteseo-tabs" class="wrap">
<div class="siteseo-nav-tab-wrapper">';
foreach($titles_meta_subtabs as $tab_key => $tab_caption) {
$active_class = ($current_tab === $tab_key) ? ' siteseo-nav-tab-active' : '';
echo '<a id="' . esc_attr($tab_key) . '-tab" class="siteseo-nav-tab' . esc_attr($active_class) . '" data-tab="' . esc_attr($tab_key) . '">' . esc_html($tab_caption) . '</a>';
}
echo '</div>
<div class="tab-content-wrapper">
<div class="siteseo-tab '.($current_tab == 'tab_siteseo_home' ? ' active' : '').'" id="tab_siteseo_home" style="display: none;">';
self::home();
echo '</div>
<div class="siteseo-tab '.($current_tab == 'tab_siteseo_post_types' ? ' active' : '').'" id="tab_siteseo_post_types" style="display: none;">';
self::post_types();
echo '</div>
<div class="siteseo-tab '.($current_tab == 'tab_siteseo_archives' ? ' active' : '').'" id="tab_siteseo_archives" style="display: none;">';
self::archives();
echo '</div>
<div class="siteseo-tab '.($current_tab == 'tab_siteseo_taxonomies' ? ' active' : '').'" id="tab_siteseo_taxonomies" style="display: none;" style="display: none;">';
self::taxonomies();
echo '</div>
<div class="siteseo-tab '.($current_tab == 'tab_siteseo_advanced' ? ' active' : '').'" id="tab_siteseo_advanced">';
self::advanced();
echo '</div>
</div>';
Util::submit_btn();
echo '</form></div>';
}
static function home(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
$options = get_option('siteseo_titles_option_name');
//$options = $siteseo->titles_settings;
$option_separator = !empty($options['titles_sep']) ? $options['titles_sep'] : '';
$option_site_title = !empty($options['titles_home_site_title']) ? $options['titles_home_site_title'] : '';
$option_site_title_alt = !empty($options['titles_home_site_title_alt']) ? $options['titles_home_site_title_alt'] : '';
$option_site_desc = !empty($options['titles_home_site_desc']) ? $options['titles_home_site_desc'] : '';
if(get_option('show_on_front') === 'page'){
$front_page_id = get_option('page_on_front');
$edit_link = get_edit_post_link($front_page_id, '');
echo'<div class="siteseo_wrap_label">
<div class="siteseo-notice is-warning">
<span id="dashicons-warning" class="dashicons dashicons-info"></span>
<p>'. // translators: %s is the platform name
wp_kses_post(sprintf(__('A static page is set as your site front page <strong>(%s Dashboard > Settings > Reading)</strong>. To add an SEO title, description, and meta tags for the homepage, please click here -', 'siteseo'), !defined('SITEPAD') ? 'WP' : 'Sitepad')) . '</p>
<div>
<a href="'.esc_url($edit_link).'" target="_blank">'.esc_html__('Edit Home Page', 'siteseo').'</a>
</div>
</div>
</div>';
return;
}
echo '<h3 class="siteseo-tabs">'.esc_html__('HOME','siteseo').'</h3>
<div class="siteseo-notice">
<span id="siteseo-dash-icon" class="dashicons dashicons-info"></span>
<p>'.esc_html__('Search engines use the title and meta description to create a snippet of your site for the search results page.', 'siteseo').'</p>
</div>
<p>'.esc_html__('Personalize the title and meta description for your homepage.','siteseo').'</p>
<span class="dashicons dashicons-external"></span>
<a href="'.esc_attr('https://siteseo.io/docs/meta/google-uses-the-wrong-meta-title-meta-description-in-search-results/').'" target="_blank">'.esc_html__('Incorrect meta title or description appearing in search results?', 'siteseo').'</a>
<table class="form-table">
<tbody>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Separator','siteseo').'</th>
<td>
<input type="text" name="siteseo_options[separator]" placeholder="'.esc_attr__('Specify your separator, e.g:-','siteseo').'" value="'.esc_attr($option_separator).'">
<p class="description">'.esc_attr__('Include this separator using %%sep%% in your title and meta description.','siteseo').'</p>
</td>
</tr>
<td colspan="2"><span class="dashed-line"></span></td>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Site title','siteseo').'</th>
<td>
<input type="text" name="siteseo_options[site_title]" value="'.esc_attr($option_site_title).'" placeholder="'.esc_html__('My fantastic site','siteseo').'">
<div class="wrap-tags">
<button class="tag-title-btn" id="btn-site-title" data-tag="%%sitetitle%%"><span id="icon" class="dashicons dashicons-insert"></span>'.
esc_html__('SITE TITLE','siteseo').'</button>
<button class="tag-title-btn" id="btn-separator" data-tag="%%sep%%"><span id="icon" class="dashicons dashicons-insert"></span>'.
esc_html__('SEPARATOR','siteseo').'</button>
<button class="tag-title-btn" id="btn-tagline" data-tag="%%tagline%%"><span id="icon" class="dashicons dashicons-insert"></span>'.
esc_html__('TAGLINE','siteseo').'</button>';
siteseo_suggestion_button();
echo '</div>
</td>
</tr>
<td colspan="2"><span class="dashed-line"></span></td>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Alternative site title','siteseo').'</th>
<td>
<input type="text" value="'.esc_attr($option_site_title_alt).'" name="siteseo_options[alt_site_title]" placeholder="'.esc_html__('Alternative website title','siteseo').'">
<p class="description">'.esc_html__('The alternative name of the website (e.g., a commonly recognized acronym or shorter name, if applicable). Ensure the name meets the criteria.', 'siteseo').'</p>
</td>
</tr>
<td colspan="2"><span class="dashed-line"></span></td>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Meta description','siteseo').'</th>
<td>
<textarea type="text" name="siteseo_options[media_desc]" placeholder="'.esc_html__('This is an awesome website about galactic creatures.','siteseo').'">'.esc_html($option_site_desc).'</textarea>
<div class="wrap-tags">
<button class="tag-title-btn" id="btn-tagline-meta" data-tag="%%tagline%%"><span id="icon" class="dashicons dashicons-insert"></span>'.
esc_html__('TAGLINE','siteseo').'</button>';
siteseo_suggestion_button();
echo '</div>
</td>
</tr>
</tbody>
</table>
<input type="hidden" name="siteseo_options[home_tab]" value="1"/>';
}
static function advanced(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
//$options = $siteseo->titles_settings;
$options = get_option('siteseo_titles_option_name');
$option_noindex = !empty($options['titles_noindex']) ? $options['titles_noindex'] : '';
$option_nofollow = !empty($options['titles_nofollow']) ? $options['titles_nofollow'] : '';
$option_noimage = !empty($options['titles_noimageindex']) ? $options['titles_noimageindex'] : '';
$option_noarchive = !empty($options['titles_noarchive']) ? $options['titles_noarchive'] : '';
$option_nosnippet = !empty($options['titles_nosnippet']) ? $options['titles_nosnippet'] : '';
$option_nositelinkssearchbox = !empty($options['titles_nositelinkssearchbox']) ? $options['titles_nositelinkssearchbox'] : '';
$option_page_rel = !empty($options['titles_paged_rel']) ? $options['titles_paged_rel'] : '';
$option_paged_noindex = !empty($options['titles_paged_noindex']) ? $options['titles_paged_noindex'] : '';
$option_attachments_noindex = !empty($options['titles_attachments_noindex']) ? $options['titles_attachments_noindex'] : '';
echo '<h3 class="siteseo-tabs">'.esc_html__('Advanced','siteseo').'</h3>
<p>'.esc_html__('Customize your metas for all pages','siteseo').'</p>
<table class="form-table">
<tbody>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('noindex','siteseo').'</th>
<td>
<label>
<input name="siteseo_options[noindex]" type="checkbox" '.(!empty($option_noindex) ? 'checked="yes"' : '') . ' value="1"/>' . esc_html__('noindex', 'siteseo') .
'</label>
<p class="description">'.esc_attr__('Do not show all pages of the site in Google search results and avoid displaying "Cached" links in search results.','siteseo').'</p>
'.wp_kses_post('<p class="description">Check also the<strong>"Search engine visibility"</strong> setting from the <a href="%s">WordPress Reading page</a></p>').'
</td>
</tr>
<td colspan="2"><span class="dashed-line"></span></td>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('nofollow','siteseo').'</th>
<td>
<label>
<input name="siteseo_options[no_follow]" type="checkbox"'.(!empty($option_nofollow) ? 'checked="yes"' : '') . ' value="1"/>'. esc_html__('nofollow', 'siteseo').
'</label>
<p class="description">'.esc_html__('Do not follow links on all pages.','siteseo').'</p>
</td>
<tr>
<td colspan="2"><span class="dashed-line"></span></td>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('noimageindex','siteseo').'</th>
<td>
<label>
<input name="siteseo_options[no_image]" type="checkbox"'.(!empty($option_noimage) ? 'checked="yes"' : '').' value="1"/>'. esc_html__('noimageindex', 'siteseo').
'</label>
<p class="description">'.esc_html__('Do not follow links on any pages.','siteseo').'</p>
</td>
<tr>
<td colspan="2"><span class="dashed-line"></span></td>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('noarchive','siteseo').'</th>
<td>
<label>
<input name="siteseo_options[no_archive]" type="checkbox"'.(!empty($option_noarchive) ? 'checked="yes"' : '').' value="1"/>' . esc_html__('noarchive', 'siteseo').
'</label>
<p class="description">'.esc_html__('Do not show a "Cached" link in Google search results.','siteseo').'</p>
</td>
</tr>
<td colspan="2"><span class="dashed-line"></span></td>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('nosnippet','siteseo').'</th>
<td>
<label>
<input name="siteseo_options[no_snippet]" type="checkbox"'.(!empty($option_nosnippet) ? 'checked="yes"' : '').' value="1"/>' . esc_html__('nosnippet', 'siteseo').
'</label>
<p class="description">'.esc_html__('Do not show a description in the Google search results for any pages.','siteseo').'</p>
</td>
</tr>
<td colspan="2"><span class="dashed-line"></span></td>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('nositelinkssearchbox','siteseo').'</th>
<td>
<label>
<input name="siteseo_options[no_site_links_searchbox]" type="checkbox"'.(!empty($option_nositelinkssearchbox) ? 'checked="yes"' : ''). ' value="1"/>' . esc_html__('nositelinkssearchbox', 'siteseo') .
'</label>
<p class="description">'.esc_html__('Prevents Google from displaying a sitelinks search box in search results. Enabling this option will remove the "Website" schema from your source code.','siteseo') .'</p>
</td>
</tr>
<td colspan="2"><span class="dashed-line"></span></td>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Indicate paginated content to Google','siteseo').'</th>
<td>
<label>
<input name="siteseo_options[page_rel]" type="checkbox"' . (!empty($option_page_rel) ? 'checked="yes"' : '') . ' value="1"/>' . esc_html__('Add rel next/prev link in head of paginated archive pages', 'siteseo') .
'</label>
<p class="description">'.esc_html__('eg: https://example.com/category/my-category/page/2/.','siteseo').'</p>
</td>
</tr>
<td colspan="2"><span class="dashed-line"></span></td>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('noindex on paged archives','siteseo').'</th>
<td>
<label>
<input name="siteseo_options[titles_paged_noindex]" type="checkbox" '. (!empty($option_paged_noindex) ? 'checked="yes"' : '') . ' value="1"/>'.esc_html__('Add a "noindex" meta robots for all paginated archive pages', 'siteseo').
'</label>
<p class="description">'.esc_html__('eg: https://example.com/category/my-category/page/2/.','siteseo').'</p>
</td>
</tr>
<td colspan="2"><span class="dashed-line"></span></td>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('noindex on attachment pages','siteseo').'</th>
<td>
<label>
<input name="siteseo_options[attachments_noindex]" type="checkbox"' . (!empty($option_attachments_noindex) ? 'checked="yes"' : '').' value="1"/>'.esc_html__(' Add a "noindex" meta robots for all attachment pages', 'siteseo') .
'</label>
<p class="description">'.esc_html__('eg: https://example.com/my-media-attachment-page.','siteseo').'</p>
</td>
</tr>
</tbody>
</table><input type="hidden" name="siteseo_options[advanced_tab]" value="1"/>';
}
static function archives(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
// $options = $siteseo->titles_settings;
$options = get_option('siteseo_titles_option_name');
// Load settings
$option_author_title = !empty($options['titles_archives_author_title']) ? $options['titles_archives_author_title'] : '';
$option_author_desc = !empty($options['titles_archives_author_desc']) ? $options['titles_archives_author_desc'] : '';
$option_author_noindex = !empty($options['titles_archives_author_noindex']) ? $options['titles_archives_author_noindex'] : '';
$option_author_disabled = !empty($options['titles_archives_author_disable']) ? $options['titles_archives_author_disable'] : '';
$option_date_title = !empty($options['titles_archives_date_title']) ? $options['titles_archives_date_title'] : '';
$option_date_desc = !empty($options['titles_archives_date_desc']) ? $options['titles_archives_date_desc'] : '';
$option_date_noindex = !empty($options['titles_archives_date_noindex']) ? $options['titles_archives_date_noindex'] : '';
$option_date_disabled = !empty($options['titles_archives_date_disable']) ? $options['titles_archives_date_disable'] : '';
$option_search_title = !empty($options['titles_archives_search_title']) ? $options['titles_archives_search_title'] : '';
$option_search_desc = !empty($options['titles_archives_search_desc']) ? $options['titles_archives_search_desc'] : '';
$option_search_noindex = !empty($options['titles_archives_search_title_noindex']) ? $options['titles_archives_search_title_noindex'] : '';
$option_404_title = !empty($options['titles_archives_404_title']) ? $options['titles_archives_404_title'] : '';
$option_404_desc = !empty($options['titles_archives_404_desc']) ? $options['titles_archives_404_desc'] : '';
$author_base_url = !empty($options['author_base_url']) ? $options['author_base_url'] : 'author';
$archives_fields = [
'author-archives' => 'Author archives',
'date-archives' => 'Date archives',
'search-archives' => 'Search archives',
'404-archives' => '404 archives'
];
$post_types = siteseo_post_types();
echo'<table class="form-table">
<tbody>
<tr>
<th scope="row">
<div class="siteseo-container">';
$is_first = true;
foreach($archives_fields as $post_key => $post_val){
$active_class = $is_first ? 'active' : '';
echo '<a href="-' . esc_attr($post_key) . '" class="' . esc_attr($active_class) . '">' . esc_html($post_val) . '</a>';
$is_first = false;
}
foreach($post_types as $post_name => $post_type){
if($post_type->has_archive){
$active_class = $is_first ? 'active' : '';
echo '<a href="-' . esc_attr($post_name) . '" class="' . esc_attr($active_class) . '">' . esc_html($post_type->label) . '</a>';
$is_first = false;
}
}
echo '</div>
</th>
<td>
<div id="author-archives">
<h3>'.esc_html__('Archives', 'siteseo').'</h3>
<div class="siteseo_wrap_label">
<p class="description">'.esc_html__('Personalize your meta descriptions for all archives.','siteseo').'</p>
</div>
<span class="line"></span>
<h3>'.esc_html__('Author archives', 'siteseo').'</h3>
<div class="siteseo_wrap_label"><p>'.esc_html__('Title template', 'siteseo').'</p></div>
<input type="text" name="siteseo_options[author_title]" value="'. esc_attr($option_author_title) . '">
<div class="wrap-tags">
<button class="tag-title-btn" id="btn-author-acrhive-title" data-tag="%%post_author%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('POST AUTHOR','siteseo').'
</button>
<button class="tag-title-btn" id="btn-author-acrhive-separator" data-tag="%%sep%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR','siteseo').'
</button>
<button class="tag-title-btn" id="btn-author-acrhive-sitetitle" data-tag="%%sitetitle%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE','siteseo').'
</button>';
siteseo_suggestion_button();
echo '</div>
<div class="siteseo_wrap_label"><p>Meta description template</p></div>
<textarea name="siteseo_options[author_desc]">'.esc_html($option_author_desc) . '</textarea><br>
<div class="siteseo_wrap_label">
<label>
<input name="siteseo_options[author_noindex]" type="checkbox" '.(!empty($option_author_noindex) ? 'checked="yes"' : '').' value="1"/>' . wp_kses_post('Do not display author archives in search engine results <strong>(noindex)</strong>') .'
</label>
<label>
<input name="siteseo_options[author_disable]" type="checkbox" '.(!empty($option_author_disabled) ? 'checked="yes"' : '').' value="1"/>
' . esc_html__('Disable author archives', 'siteseo') . '
</label>
</div>
<div class="siteseo_wrap_label"><p style="font-weight: 500;">'.esc_html__('Author base', 'siteseo');
if(!defined('SITESEO_PRO_VERSION')){
echo'<span class="siteseo-pro-tag">Pro</span>';
}
echo'</p></div>
<input type="text" name="siteseo_options[author_base]" value="' . esc_attr($author_base_url) . '" ' .(!defined('SITESEO_PRO_VERSION') ? 'disabled="disabled" style="cursor:not-allowed;"' : '').'>
<div class="siteseo_wrap_label"><p>'.esc_html__('Change the /author/ slug used in author archive URLs.', 'siteseo').'</p>
</div>
<div id="date-archives">
<h3>'.esc_html__('Date archives', 'siteseo').'</h3>
<div class="siteseo_wrap_label"><p>'.esc_html__('Title template','siteseo').'</p></div>
<input type="text" name="siteseo_options[date_title]" value="'. esc_attr($option_date_title) .'">
<div class="wrap-tags">
<button class="tag-title-btn" id="btn-date-archive" data-tag="%%archive_date%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('DATE ARCHIVES','siteseo').'
</button>
<button class="tag-title-btn" id="btn-date-separator" data-tag="%%sep%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR','siteseo').'
</button>
<button class="tag-title-btn" id="btn-date-sitetitle" data-tag="%%sitetitle%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE','siteseo').'
</button>';
siteseo_suggestion_button();
echo '</div>
<div class="siteseo_wrap_label"><p>'.esc_html__('Meta description template','siteseo').'</p></div>
<textarea name="siteseo_options[date_desc]">'.esc_attr($option_date_desc).'</textarea><br>
<div class="siteseo_wrap_label">
<label>
<input name="siteseo_options[date_noindex]" type="checkbox" '.(!empty($option_date_noindex) ? 'checked="yes"' : '').' value="1"/>' . wp_kses_post('Do not display date archives in search engine results <strong>(noindex)</strong>') . '
</label>
<label>
<input name="siteseo_options[date_disable]" type="checkbox" '.(!empty($option_date_disabled) ? 'checked="yes"' : '').' value="1"/>
' . esc_html__('Disable date archives', 'siteseo') . '
</label>
</div>
<span class="line"><span>
</div>
<div id="search-archives">
<h3>Search archives</h3>
<div class="siteseo_wrap_label"><p>'.esc_html__('Title template','siteseo').'</p></div>
<input type="text" name="siteseo_options[search_title]" value="'.esc_attr($option_search_title).'">
<div class="wrap-tags">
<button class="tag-title-btn" id="btn-search-keyword" data-tag="%%search_keywords%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEARCH KEYWORDS','siteseo').'
</button>
<button class="tag-title-btn" id="btn-search-separator" data-tag="%%sep%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR','siteseo').'
</button>
<button class="tag-title-btn" id="btn-search-sitetitle" data-tag="%%sitetitle%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE','siteseo').'
</button>';
siteseo_suggestion_button();
echo '</div>
<div class="siteseo_wrap_label"><p>'.esc_html__('Meta description template','siteseo').'</p></div>
<textarea name="siteseo_options[search_desc]">'.esc_attr($option_search_desc).'</textarea><br>
<div class="siteseo_wrap_label">
<label>
<input name="siteseo_options[search_noindex]" type="checkbox" '.(!empty($option_search_noindex) ? 'checked="yes"' : '').' value="1"/>
' . wp_kses_post('Do not display date archives in search engine results <strong>(noindex)</strong>') . '
</label>
</div>
<span class="line"><span>
</div>
<div id="404-archives">
<h3>404 archives</h3>
<div class="siteseo_wrap_label"><p>'.esc_html__('Title template','siteseo').'</p></div>
<input type="text" name="siteseo_options[title_404]" value="'.esc_attr($option_404_title).'">
<div class="wrap-tags">
<button class="tag-title-btn" id="btn-404-sitetitle" data-tag="%%sep%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR','siteseo').'
</button>
<button class="tag-title-btn" id="btn-404-separator" data-tag="%%sitetitle%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE','siteseo').'
</button>';
siteseo_suggestion_button();
echo '</div>
<div class="siteseo_wrap_label"><p>'.esc_html__('Meta description template','siteseo').'</p></div>
<textarea name="siteseo_options[desc_404]">'.esc_attr($option_404_desc).'</textarea><br>
</div>
<br/><br/>
<span class="line"></span>';
foreach($post_types as $post_name => $post_type){
if(empty($post_type->has_archive)){
continue;
}
$post_data = isset($options['titles_archive_titles'][$post_name]) ? $options['titles_archive_titles'][$post_name] : '';
$archive_title = !empty($post_data['archive_title'])? $post_data['archive_title'] : '';
$archive_description = !empty($post_data['archive_desc']) ? $post_data['archive_desc'] : '';
$archive_noindex = !empty($post_data['archive_noindex']) ? $post_data['archive_noindex'] : '';
$archive_nofollow = !empty($post_data['archive_nofollow']) ? $post_data['archive_nofollow'] : '';
$value_check = !empty($options['titles_archive_titles'][$post_name]['archive_title']) ? $options['titles_archive_titles'][$post_name]['archive_title'] : '';
echo'<div id="'.esc_attr($post_name).'">
<h3>'.esc_html($post_type->label).'</h3>
<div class="siteseo_wrap_label"><p>'.esc_html__('Title template','siteseo').'</p></div>
<input type="text" name="siteseo_options['.esc_attr($post_name).'][archive_title]" value="'.esc_attr($archive_title).'">
<div class="wrap-tags">
<button class="tag-title-btn" data-tag="%%cpt_plural%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('POST TYPE ARCHIVE NAME','siteseo').'
</button>
<button class="tag-title-btn" data-tag="%%sep%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR','siteseo').'
</button>
<button class="tag-title-btn" data-tag="%%sitetitle%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE','siteseo').'
</button>';
siteseo_suggestion_button();
echo'</div>
<div class="siteseo_wrap_label"><p>'.esc_html__('Meta description template','siteseo').'</p></div>
<textarea name="siteseo_options['.esc_attr($post_name).'][archive_desc]">'.esc_attr($archive_description).'</textarea><div class="wrap-tags">';
siteseo_suggestion_button();
echo'</div></div><br>
<div class="siteseo_wrap_label">
<label>
<input name="siteseo_options['.esc_attr($post_name).'][archive_noindex]" type="checkbox" '.(!empty($archive_noindex) ? 'checked="yes"' : '').' value="1"/>
' . wp_kses_post('Do not display author archives in search engine results <strong>(noindex)</strong>') .'
</label><br/><br/>
<label>
<input name="siteseo_options['.esc_attr($post_name).'][archive_nofollow]" type="checkbox" '.(!empty($archive_nofollow) ? 'checked="yes"' : 'value="1"').' />'.wp_kses_post(__('Do not follow links for this taxonomy archive<strong>(nofollow)</strong>', 'siteseo')).'
</label>
</div><span class="line"><span>';
}
echo'</td>
</tr>
</tbody>
</table>
<input type="hidden" name="siteseo_options[archives_tab]" value="1"/>';
}
static function post_types(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
$options = get_option('siteseo_titles_option_name');
$post_types = siteseo_post_types();
echo '<table class="form-table">
<tbody>
<tr>
<th scope="row">
<div class="siteseo-container">';
$is_first = true;
foreach($post_types as $post_type => $post_arr){
$active_class = $is_first ? 'active' : '';
echo '<a href="#'.esc_attr($post_type).'-types" class="'.esc_attr($active_class).'">'.esc_html($post_arr->labels->name).'</a>';
$is_first = false;
}
echo '</div>
</th><td>
<div>
<h3>'.esc_html__('Post Types', 'siteseo').'</h3>
<div class="siteseo_wrap_label"><p class="description">'.esc_html__('Personalize your titles and meta descriptions for single custom post types.', 'siteseo').'</p></div>
</div>';
foreach($post_types as $post_type => $post_arr){
// Load array
$post_data = isset($options['titles_single_titles'][$post_type]) ? $options['titles_single_titles'][$post_type] : '';
// Load settings
$option_post_disabled = !empty($post_data['disabled']) ? true : false;
$option_post_title = !empty($post_data['title']) ? $post_data['title'] : '';
$option_post_desc = !empty($post_data['description']) ? $post_data['description'] : '';
$option_noindex = !empty($post_data['noindex']) ? $post_data['noindex'] : '';
$option_nofollow = !empty($post_data['nofollow']) ? $post_data['nofollow'] : '';
$option_date = !empty($post_data['date']) ? $post_data['date'] : '';
$option_thumb_gcs = !empty($post_data['thumb_gcs']) ? $post_data['thumb_gcs'] : '';
echo '<div id="'.esc_attr($post_type).'-types">';
echo '<div class="siteseo-toggle-cnt">
<h3>'.esc_html($post_arr->labels->name.' ['.$post_type.']').'</h3>
<div class="siteseo-toggle-meta '.($option_post_disabled ? '' : 'active').'" id="siteseo-toggle-meta-'.esc_attr($post_type).'"></div>
<span id="siteseo-arrow-icon" class="dashicons dashicons-arrow-left-alt siteseo-arrow-icon"></span>
<p class="toggle_state_posts" id="toggle_state_'.esc_attr($post_type).'">'.(!$option_post_disabled ? ' Click to hide any SEO metaboxes / columns for this post type' : ' Click to show any SEO metaboxes / columns for this post type').'</p>
<input type="hidden" name="siteseo_options['.esc_attr($post_type).'][disabled]" id="enable_'.esc_attr($post_type).'_toggle" value="'.esc_attr($option_post_disabled).'" class="siteseo-suboption-toggle">
</div>
<div class="siteseo_wrap_label"><p>'.esc_html__('Title template', 'siteseo').'</p></div>
<input type="text" name="siteseo_options['.esc_attr($post_type).'][title]" value="'.esc_attr($option_post_title).'">
<div class="wrap-tags">
<button class="tag-title-btn" id="btn-post-title" data-tag="%%post_title%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('POST TITLE', 'siteseo').'
</button>
<button class="tag-title-btn" id="btn-post-separator" data-tag="%%sep%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR', 'siteseo').'
</button>
<button class="tag-title-btn" id="btn-post-site-title" data-tag="%%sitetitle%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE', 'siteseo').'
</button>';
siteseo_suggestion_button();
echo '</div>
<div class="siteseo_wrap_label"><p class="description">'.esc_html__('Meta description template', 'siteseo').'</p></div>
<textarea name="siteseo_options['.esc_attr($post_type).'][desc]">'.esc_attr($option_post_desc).'</textarea>
<div class="wrap-tags">
<button class="tag-title-btn" id="btn-'.esc_attr($post_type).'-meta" data-tag="%%post_excerpt%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('POST EXCERPT', 'siteseo').'
</button>';
siteseo_suggestion_button();
echo '</div>
<div class="siteseo_wrap_label">
<label>
<input name="siteseo_options['.esc_attr($post_type).'][noindex]" type="checkbox" '.(!empty($option_noindex) ? 'checked="yes"' : 'value="1"').' />
'.wp_kses_post(__('Do not display this single post type in search engine results <strong>(noindex)</strong>', 'siteseo')).'
</label>
</div>';
if(!empty($option_noindex)){
echo '<div class="siteseo_wrap_label">
<div class="siteseo-notice is-error">
<p>'.wp_kses_post(__('This custom post type is <strong>NOT</strong> excluded from your XML sitemaps despite the fact that it is set to <strong>NOINDEX</strong>.', 'siteseo')).'
</p>
</div>
</div>';
}
echo '<div class="siteseo_wrap_label">
<label>
<input name="siteseo_options['.esc_attr($post_type).'][nofollow]" type="checkbox" '.(!empty($option_nofollow) ? 'checked="yes"' : 'value="1"').' />
'.wp_kses_post(__('Do not follow links for this single post type <strong>nofollow</strong>', 'siteseo')).'
</label>
</div>
<div class="siteseo_wrap_label">
<label>
<input name="siteseo_options['.esc_attr($post_type).'][date]" type="checkbox" '.(!empty($option_date) ? 'checked="yes"' : 'value="1"').' />
'.esc_html__('Display date in Google search results by adding article:published_time and article:modified_time meta?', 'siteseo').'
</label>
<p class="description">'. esc_html__('Unchecking this does not prevent Google from displaying the post date in search results.', 'siteseo').'</p>
</div>
<div class="siteseo_wrap_label">
<label>
<input name="siteseo_options['.esc_attr($post_type).'][thumb_gcs]" type="checkbox" '.(!empty($option_thumb_gcs) ? 'checked="yes"' : 'value="1"').' />
'.esc_html__('Display post thumbnail in Google Custom Search results?', 'siteseo').'
</label>
<p class="description">'.esc_html__('This option does not apply to traditional search results.', 'siteseo').'</p>
</div>
</div>';
}
echo '</td></tr>
</tbody>
</table>
<input type="hidden" name="siteseo_options[post_types_tab]" value="1"/>';
}
static function taxonomies(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
// $options = $siteseo->titles_setting;
$options = get_option('siteseo_titles_option_name');
$taxonomies = get_taxonomies(['show_ui' => true, 'public' => true], 'objects', 'and');
echo '<table class="form-table">
<tbody>
<tr>
<th scope="row">
<div class="siteseo-container">';
$is_first = true;
foreach($taxonomies as $fields_key => $fields_val){
$active_class = $is_first ? 'active' : '';
echo '<a href="#'.esc_attr($fields_key).'-types" class="'.esc_attr($active_class).'">'.esc_html($fields_val->label).'</a>';
$is_first = false;
}
echo '</th>
<td>
<h3>'.esc_html__('Taxonomies','siteseo').'</h3>
<div class="siteseo_wrap_label">
<p class="description">'.esc_html__('Personalize your meta descriptions for all taxonomy archives.','siteseo').'</p>
</div>';
foreach($taxonomies as $taxonomy => $_tax){
// Load array
$options_tax = isset($options['titles_tax_titles'][$taxonomy]) ? $options['titles_tax_titles'][$taxonomy] : '';
// Load settings
$option_disabled_category = !empty($options_tax['disabled']) ? $options_tax['disabled'] : '';
$option_cat_title = !empty($options_tax['title']) ? $options_tax['title'] : '';
$option_cat_desc = !empty($options_tax['description']) ? $options_tax['description'] : '';
$option_cat_noindex = !empty($options_tax['noindex']) ? $options_tax['noindex'] : '';
$option_cat_nofollow = !empty($options_tax['nofollow']) ? $options_tax['nofollow'] : '';
$taxonomies_fields = [
'categories-types' => 'Categories',
'tags-types' => 'Tags',
];
echo '<div id="'.esc_attr($taxonomy).'-types"><h3>'.esc_html($_tax->label.'['.$taxonomy.']').'</h3>
<div class="siteseo-toggle-cnt">
<div class="siteseo-toggle-meta '.($option_disabled_category ? '' : 'active').'" id="siteseo-toggle-meta-category"></div>
<span id="siteseo-arrow-icon" class="dashicons dashicons-arrow-left-alt siteseo-arrow-icon"></span>
<p class="toggle_state_category" id="toggle_state_category">' .($option_disabled_category ? 'Enable' : 'Disable'). '</p>
<input type="hidden" name="siteseo_options['.esc_attr($taxonomy).'][disabled]" id="enable_'.esc_attr($taxonomy).'" value="'.esc_attr($option_disabled_category).'" class="siteseo-suboption-toggle">
</div>
<div class="siteseo_wrap_label">
<p class="description">'.esc_html__('Title template','siteseo').'</p>
</div>
<input type="text" value="'.esc_attr($option_cat_title).'" name="siteseo_options['.esc_attr($taxonomy).'][title]">
<div class="wrap-tags">
<button class="tag-title-btn" data-tag="%%_category_title%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('CATEGORY TITLE','siteseo').'
</button>
<button class="tag-title-btn" data-tag="%%sep%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SEPARATOR','siteseo').'
</button>
<button class="tag-title-btn" data-tag="%%sitetitle%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('SITE TITLE','siteseo').'
</button>';
siteseo_suggestion_button();
echo '</div>
<div class="siteseo_wrap_label">
<p class="description">Meta description template</p>
</div>
<textarea name="siteseo_options['.esc_attr($taxonomy).'][desc]">'.esc_attr($option_cat_desc).'</textarea>
<div class="wrap-tags">
<button class="tag-title-btn" data-tag="%%_category_description%%">
<span id="icon" class="dashicons dashicons-insert"></span>'.esc_html__('CATEGORY DESCRIPTION','siteseo').'
</button>';
siteseo_suggestion_button();
echo '</div>
<div class="siteseo_wrap_label">
<label>
<input name="siteseo_options['.esc_attr($taxonomy).'][noindex]" type="checkbox" '.(!empty($option_cat_noindex) ? 'checked="yes"' : 'value="1"').' />
'.wp_kses_post(__('Do not display this taxonomy archive in search engine results<strong>(noindex)</strong>', 'siteseo')).'
</label>
</div>';
if(!empty($option_cat_noindex)){
echo '<div class="siteseo_wrap_label">
<div class="siteseo-notice is-error">
<p>'.wp_kses_post(__('This custom taxonomy is <strong>NOT</strong> excluded from your XML sitemaps despite the fact that it is set to <strong>NOINDEX</strong>. We recommend that you check this out.', 'siteseo')).'
</p>
</div>
</div>';
}
echo '<div class="siteseo_wrap_label">
<label>
<input name="siteseo_options['.esc_attr($taxonomy).'][nofollow]" type="checkbox" '.(!empty($option_cat_nofollow) ? 'checked="yes"' : 'value="1"').' />
'.wp_kses_post(__('Do not follow links for this taxonomy archive<strong>(nofollow)</strong>', 'siteseo')).'
</label>
</div>
</div>';
}
echo '</td>
</tr>
</tbody>
</table>
<input type="hidden" name="siteseo_options[taxonomies_tab]" value="1"/>';
}
static function save_settings(){
global $siteseo;
check_admin_referer('siteseo_title_settings');
if(!siteseo_user_can('manage_title') || !is_admin()){
return;
}
$options = [];
if(empty($_POST['siteseo_options'])){
return;
}
if(isset($_POST['siteseo_options']['home_tab'])){
$options['titles_sep'] = isset($_POST['siteseo_options']['separator']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['separator'])) : '';
$options['titles_home_site_title'] = isset($_POST['siteseo_options']['site_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['site_title'])) : '';
$options['titles_home_site_title_alt'] = isset($_POST['siteseo_options']['alt_site_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['alt_site_title'])) : '';
$options['titles_home_site_desc'] = isset($_POST['siteseo_options']['media_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['media_desc'])) : '';
}
if(isset($_POST['siteseo_options']['advanced_tab'])){
$options['titles_noindex'] = isset($_POST['siteseo_options']['noindex']);
$options['titles_nofollow'] = isset($_POST['siteseo_options']['no_follow']);
$options['titles_noimageindex'] = isset($_POST['siteseo_options']['no_image']);
$options['titles_noarchive'] = isset($_POST['siteseo_options']['no_archive']);
$options['titles_nosnippet'] = isset($_POST['siteseo_options']['no_snippet']);
$options['titles_nositelinkssearchbox'] = isset($_POST['siteseo_options']['no_site_links_searchbox']);
$options['titles_paged_rel'] = isset($_POST['siteseo_options']['page_rel']);
$options['titles_paged_noindex'] = isset($_POST['siteseo_options']['titles_paged_noindex']);
$options['titles_attachments_noindex'] = isset($_POST['siteseo_options']['attachments_noindex']);
}
if(isset($_POST['siteseo_options']['post_types_tab'])){
$post_types = siteseo_post_types();
$post_types = array_keys($post_types);
// Saving Posts
foreach($post_types as $post_type){
$options['titles_single_titles'][$post_type]['disabled'] = !empty($_POST['siteseo_options'][$post_type]['disabled']) ? true : false;
$options['titles_single_titles'][$post_type]['title'] = isset($_POST['siteseo_options'][$post_type]['title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options'][$post_type]['title'])) : '';
$options['titles_single_titles'][$post_type]['description'] = isset($_POST['siteseo_options'][$post_type]['desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options'][$post_type]['desc'])) : '';
$options['titles_single_titles'][$post_type]['noindex'] = isset($_POST['siteseo_options'][$post_type]['noindex']);
$options['titles_single_titles'][$post_type]['nofollow'] = isset($_POST['siteseo_options'][$post_type]['nofollow']);
$options['titles_single_titles'][$post_type]['date'] = isset($_POST['siteseo_options'][$post_type]['date']);
$options['titles_single_titles'][$post_type]['thumb_gcs'] = isset($_POST['siteseo_options'][$post_type]['thumb_gcs']);
}
}
if(isset($_POST['siteseo_options']['archives_tab'])){
$post_types = siteseo_post_types();
$post_types = array_keys($post_types);
$options['titles_archives_author_title'] = isset($_POST['siteseo_options']['author_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['author_title'])) : '';
$options['titles_archives_author_desc'] = isset($_POST['siteseo_options']['author_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['author_desc'])) : '';
$options['titles_archives_author_noindex'] = isset($_POST['siteseo_options']['author_noindex']);
$options['titles_archives_author_disable'] = isset($_POST['siteseo_options']['author_disable']);
$options['titles_archives_date_title'] = isset($_POST['siteseo_options']['date_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['date_title'])) : '';
$options['titles_archives_date_desc'] = isset($_POST['siteseo_options']['date_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['date_desc'])) : '';
$options['titles_archives_date_noindex'] = isset($_POST['siteseo_options']['date_noindex']);
$options['titles_archives_date_disable'] = isset($_POST['siteseo_options']['date_disable']);
$options['titles_archives_search_title'] = isset($_POST['siteseo_options']['search_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['search_title'])) : '';
$options['titles_archives_search_desc'] = isset($_POST['siteseo_options']['search_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['search_desc'])) : '';
$options['titles_archives_search_title_noindex'] = isset($_POST['siteseo_options']['search_noindex']);
$options['titles_archives_404_title'] = isset($_POST['siteseo_options']['title_404']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['title_404'])) : '';
$options['titles_archives_404_desc'] = isset($_POST['siteseo_options']['desc_404']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['desc_404'])) : '';
foreach($post_types as $post_type){
$options['titles_archive_titles'][$post_type]['archive_title'] = isset($_POST['siteseo_options'][$post_type]['archive_title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options'][$post_type]['archive_title'])) : '';
$options['titles_archive_titles'][$post_type]['archive_desc'] = isset($_POST['siteseo_options'][$post_type]['archive_desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options'][$post_type]['archive_desc'])) : '';
$options['titles_archive_titles'][$post_type]['archive_noindex'] = isset($_POST['siteseo_options'][$post_type]['archive_noindex']);
$options['titles_archive_titles'][$post_type]['archive_nofollow'] = isset($_POST['siteseo_options'][$post_type]['archive_nofollow']);
}
}
if(isset($_POST['siteseo_options']['taxonomies_tab'])){
$taxonomies = get_taxonomies(['show_ui' => true, 'public' => true], 'objects', 'and');
$taxonomies = array_keys($taxonomies);
foreach($taxonomies as $taxonomy){
$options['titles_tax_titles'][$taxonomy]['disabled'] = !empty($_POST['siteseo_options'][$taxonomy]['disabled']) ? true : false;
$options['titles_tax_titles'][$taxonomy]['title'] = isset($_POST['siteseo_options'][$taxonomy]['title']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options'][$taxonomy]['title'])) : '';
$options['titles_tax_titles'][$taxonomy]['description'] = isset($_POST['siteseo_options'][$taxonomy]['desc']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options'][$taxonomy]['desc'])) : '';
$options['titles_tax_titles'][$taxonomy]['noindex'] = isset($_POST['siteseo_options'][$taxonomy]['noindex']);
$options['titles_tax_titles'][$taxonomy]['nofollow'] = isset($_POST['siteseo_options'][$taxonomy]['nofollow']);
}
}
$options = apply_filters('siteseo_titles_save_settings', $options);
update_option('siteseo_titles_option_name', $options);
}
}
<?php
/*
* SITESEO
* https://siteseo.io
* (c) SiteSEO Team
*/
namespace SiteSEO\Settings;
if(!defined('ABSPATH')){
die('HACKING ATTEMPT!');
}
class Analytics{
static function menu(){
global $siteseo;
$analytics_toggle = isset($siteseo->setting_enabled['toggle-google-analytics']) ? $siteseo->setting_enabled['toggle-google-analytics'] : '';
$nonce = wp_create_nonce('siteseo_toggle_nonce');
$current_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'tab_google_analytics';
$analytics_sub_tags = [
'tab_google_analytics' => esc_html__('Google Analytics', 'siteseo'),
'tab_matomo' => esc_html__('Matomo', 'siteseo'),
'tab_clarity' => esc_html__('Clarity', 'siteseo'),
'tab_advanced' => esc_html__('Advanced', 'siteseo'),
'tab_cookie' => esc_html__('Cookie bar / GDPR', 'siteseo'),
'tab_custom_tracking' => esc_html__('Custom Tracking', 'siteseo'),
];
echo '<div id="siteseo-root">';
Util::admin_header();
echo '<form method="post" id="siteseo-form" class="siteseo-option" name="siteseo-flush">';
wp_nonce_field('siteseo_analytics_settings');
Util::render_toggle('Analytics - SiteSEO', 'analytics_toggle', $analytics_toggle, $nonce);
echo '<div id="siteseo-tabs" class="wrap">
<div class="siteseo-nav-tab-wrapper">';
foreach($analytics_sub_tags as $tab_key => $tab_caption){
$active_class = ($current_tab === $tab_key) ? ' siteseo-nav-tab-active' : '';
echo '<a id="'.esc_attr($tab_key).'-tab" class="siteseo-nav-tab'.esc_attr($active_class).'" data-tab="'.esc_attr($tab_key).'">'.esc_html($tab_caption).'</a>';
}
echo '</div>
<div class="tab-content-wrapper">
<div class="siteseo-tab'.($current_tab == 'tab_google_analytics' ? ' active' : '').'" id="tab_google_analytics" style="display: none;">';
self::google_anlytics();
echo '</div>
<div class="siteseo-tab'.($current_tab == 'tab_matomo' ? ' active' : '') . '" id="tab_matomo" style="display: none;">';
self::matomo();
echo '</div>
<div class="siteseo-tab'.($current_tab == 'tab_clarity' ? ' active' : '').'" id="tab_clarity" style="display: none;">';
self::clarity();
echo '</div>
<div class="siteseo-tab'.($current_tab == 'tab_advanced' ? ' active' : '').'" id="tab_advanced" style="display: none;">';
self::advanced();
echo '</div>
<div class="siteseo-tab'.($current_tab == 'tab_cookie' ? ' active' : '').'" id="tab_cookie" style="display: none;">';
self::cookies();
echo '</div>
<div class="siteseo-tab'.($current_tab == 'tab_custom_tracking' ? 'active' : '').'" id="tab_custom_tracking" style="display: none;">';
self::custom_tracking();
echo '</div>
</div>';
Util::submit_btn();
echo '</form></div>';
}
static function custom_tracking(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
//$options = $siteseo->analaytics_settings;
$options = get_option('siteseo_google_analytics_option_name');
$option_head_tracking = !empty($options['google_analytics_other_tracking']) ? $options['google_analytics_other_tracking'] : '';
$option_body_tracking = !empty($options['google_analytics_other_tracking_body']) ? $options['google_analytics_other_tracking_body'] : '';
$option_footer_tracking = !empty($options['google_analytics_other_tracking_footer']) ? $options['google_analytics_other_tracking_footer'] : '';
echo '<h3 class="siteseo-tabs">'.esc_html__('Custom Tracking','siteseo').'</h3>
<P class="description">'.esc_html__('Add custom scripts like GTM or Facebook Pixel by copying and pasting the provided code into the HEAD, BODY, or FOOTER sections.','siteseo').'</p>
<table class="form-table">
<tbody>
<tr>
<th scope="row">'.esc_html__('[HEAD] Add an additional tracking code (like Facebook Pixel, Hotjar...)','siteseo').'</th>
<td>
<textarea name="siteseo_options[head_tracking]" rows="16" placeholder="'.esc_html__('Paste your tracking code here, such as Google Tag Manager (head). Do NOT paste GA4 or Universal Analytics codes, as they are automatically included in your source code.','siteseo').'">'.esc_html($option_head_tracking).'</textarea>
<p class="description">'.esc_html__('This code will be added in the head section of your page','siteseo').'</p>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('[BODY] Add an additional tracking code (like Google Tag Manager...)','siteseo').'</th>
<td>
<textarea name="siteseo_options[body_tracking]" rows="16" placeholder="'.esc_html__('This code will be added just after the opening body tag of your page','siteseo').'">'.esc_html($option_body_tracking).'</textarea>
<p>'.esc_html__('This code will be added just after the opening body tag of your page','siteseo').'</p>
<p>'.esc_html__('You donāt see your code? Make sure to call wp_body_open(); just after the opening body tag in your theme.','siteseo').'</p>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('[BODY (FOOTER)] Add an additional tracking code (like Google Tag Manager...)', 'siteseo').'</th>
<td>
<textarea name="siteseo_options[footer_tracking]" rows="16" placeholder="'.esc_html__('Paste your tracking code here(footer)','siteseo').'">'.esc_html($option_footer_tracking).'</textarea>
<p>'.esc_html__('This code will be added just after the closing body tag of your page','siteseo').'</P>
</td>
</tr>
</tbody>
</table><input type="hidden" name="siteseo_options[custom_tracking_tab]" value="1"/>';
}
static function cookies(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
//$options = $siteseo->analaytics_settings;
$options = get_option('siteseo_google_analytics_option_name');
$option_cookies_postion = !empty($options['google_analytics_hook']) ? $options['google_analytics_hook'] : '';
$option_tracking_opt = !empty($options['google_analytics_disable']) ? $options['google_analytics_disable'] : '';
$option_half_disable = !empty($options['google_analytics_half_disable']) ? $options['google_analytics_half_disable'] : '';
$option_opt_choices = !empty($options['google_analytics_opt_out_edit_choice']) ? $options['google_analytics_opt_out_edit_choice'] : '';
$option_opt_msg = !empty($options['google_analytics_opt_out_msg']) ? $options['google_analytics_opt_out_msg'] : '';
$option_opt_msg_ok = !empty($options['google_analytics_opt_out_msg_ok']) ? $options['google_analytics_opt_out_msg_ok'] : '';
$option_opt_msg_close = !empty($options['google_analytics_opt_out_msg_close']) ? $options['google_analytics_opt_out_msg_close'] : '';
$option_opt_msg_edit = !empty($options['google_analytics_opt_out_msg_edit']) ? $options['google_analytics_opt_out_msg_edit'] : '';
$option_cd_exp_date = !empty($options['google_analytics_cb_exp_date']) ? $options['google_analytics_cb_exp_date'] : '30';
$option_cd_pos = !empty($options['google_analytics_cb_pos']) ? $options['google_analytics_cb_pos'] : '';
$option_cd_txt_align = !empty($options['google_analytics_cb_txt_align']) ? $options['google_analytics_cb_txt_align'] : '';
$option_cd_width = !empty($options['google_analytics_cb_width']) ? $options['google_analytics_cb_width'] : '';
$option_cd_backdrop = !empty($options['google_analytics_cb_backdrop']) ? $options['google_analytics_cb_backdrop'] : '';
$option_cd_scheme = !empty($options['google_analytics_cb_scheme']) ? $options['google_analytics_cb_scheme'] : '';
//colors load
$option_backdrop_bg = !empty($options['google_analytics_cb_backdrop_bg']) ? $options['google_analytics_cb_backdrop_bg'] : '';
$option_cookiebar_bg = !empty($options['google_analytics_cb_bg']) ? $options['google_analytics_cb_bg'] : '#ffffff';
$option_cookiebar_txt = !empty($options['google_analytics_cb_txt_col']) ? $options['google_analytics_cb_txt_col'] : '#000000';
$option_cookiebar_lk = !empty($options['google_analytics_cb_lk_col']) ? $options['google_analytics_cb_lk_col'] : '#0000ff';
$option_primarybtn_bg = !empty($options['google_analytics_cb_btn_bg']) ? $options['google_analytics_cb_btn_bg'] : '#0073aa';
$option_primarybtn_bg_hov = !empty($options['google_analytics_cb_btn_bg_hov']) ? $options['google_analytics_cb_btn_bg_hov'] : '#005f8b';
$option_primarybtn_txt = !empty($options['google_analytics_cb_btn_col']) ? $options['google_analytics_cb_btn_col'] : '#ffffff';
$option_primarybtn_txt_hov = !empty($options['google_analytics_cb_btn_col_hov']) ? $options['google_analytics_cb_btn_col_hov'] : '#ffffff';
$option_sec_bg = !empty($options['google_analytics_cb_btn_sec_bg']) ? $options['google_analytics_cb_btn_sec_bg'] : '#cccccc';
$option_sec_bg_hov = !empty($options['google_analytics_cb_btn_sec_bg_hov']) ? $options['google_analytics_cb_btn_sec_bg_hov'] : '#aaaaaa';
$option_sec_bg_txt = !empty($options['google_analytics_cb_btn_sec_col']) ? $options['google_analytics_cb_btn_sec_col'] : '#000000';
$option_sec_bg_txt_hov = !empty($options['google_analytics_cb_btn_sec_col_hov']) ? $options['google_analytics_cb_btn_sec_col_hov'] : '#000000';
echo '<h3 class="siteseo-tabs">'.esc_html__('Cookies','siteseo').'</h3>
<p class="description">'.esc_html__('Easily manage user consent for GDPR and customize your cookie bar.','siteseo').'</p>
<p class="description">'.esc_html__('Compatible with Google Analytics and Matomo.','siteseo').'</p>
<table>
<tbody class="form-table">
<tr>
<div class="siteseo-notice" id="custom-dimensions">
<span class="dashicons dashicons-info"></span>
<p>'.
/* translators: placeholders are just <strong> tag */
wp_kses_post(sprintf(__('%1$s Note : %2$s This feature applies only to cookies added through SiteSEO analytics and tracking.', 'siteseo'), '<strong>', '</strong>')).'</p>
</div>
</tr>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Where to load the cookie bar?','siteseo').'</th>
<td>
<select name="siteseo_options[cookie_pos]">
<option value="wp_body_open" '.selected($option_cookies_postion, 'wp_body_open', false).'>'.esc_html__('After the opening body tag (recommended)', 'siteseo').'</option>
<option value="wp_footer" '.selected($option_cookies_postion, 'wp_footer', false).'>'.esc_html__('Footer', 'siteseo') .'</option>
<option value="wp_head" '.selected($option_cookies_postion, 'wp_head', false).'>'.esc_html__('Header (not recommended)', 'siteseo').'</option>
</select>
</td>
</tr>
<tr>
<th scope"user-select:auto">'.esc_html__('Analytics tracking opt-in','siteseo').'</th>
<td>
<label>
<input name="siteseo_options[opt_tracking]" type="checkbox" '.(!empty($option_tracking_opt) ? 'checked="yes"' : 'value="1"').' />
'.esc_html__('Obtain user consent for analytics tracking, as required by GDPR.', 'siteseo').'
</label><br/><br/>
<label>
<input type="checkbox" name="siteseo_options[half_disable]" '.(!empty($option_half_disable) ? 'checked="yes"' : 'value="1"').' />
'.esc_html__('Display and automatically accept if user does not accept or reject within 10 seconds.','siteseo').'
</label>
</td>
</tr>
<tr>
<th scope="row" style="user-select:auto:">'.esc_html__('Allow user to change its choice','siteseo').'</th>
<td>
<label>
<input name="siteseo_options[opt_edit_choices]" type="checkbox" '.(!empty($option_opt_choices) ? 'checked="yes"' : 'value="1"').' />
Allow user to change its choice about cookies'.esc_html__('Request user consent for analytics tracking (required by GDPR)', 'siteseo').'
</label>
</td>
</tr>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Consent message for user tracking','siteseo').'</th>
<td>
<textarea placeholder="'.esc_html__('Enter your message (HTML allowed)','siteseo').'" name="siteseo_options[opt_msg]" >'.esc_attr($option_opt_msg).'</textarea>
</td>
</tr>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Accept button for user tracking','siteseo').'</th>
<td>
<input type="text" name="siteseo_options[opt_msg_ok]" value="'.esc_attr($option_opt_msg_ok).'" placeholder="'.esc_html__('Accept','siteseo').'">
</td>
</tr>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Close button','siteseo').'</th>
<td>
<input type="text" name="siteseo_options[opt_close]" value="'.esc_attr($option_opt_msg_close).'" placeholder="'.esc_attr__('default:X', 'siteseo').'">
</td>
</tr>
<tr>
<th scope="row" style="user-select:auto;" >'.esc_html__('Edit cookies button','siteseo').'</th>
<td>
<input type="text" name="siteseo_options[opt_edit_btn]" value="'.esc_attr($option_opt_msg_edit).'" placeholder="'.esc_attr__('default:Manage cookie', 'siteseo').'">
</td>
</tr>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('User consent cookie expiration date','siteseo').'</th>
<td>
<input type="number" name="siteseo_options[cd_exp_date]" value="'.esc_attr($option_cd_exp_date).'" >
</td>
</tr>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Cookie bar position','siteseo').'</th>
<td>
<select name="siteseo_options[cd_pos]">
<option value="bottom" '.selected($option_cd_pos, 'bottom', false).'>'.esc_html__('Bottom (default)','siteseo').'</option>
<option value="middle" '.selected($option_cd_pos, 'middle', false).'>'.esc_html__('Middle','siteseo').'</option>
<option value="top" '.selected($option_cd_pos, 'top', false).'>'.esc_html__('Top','siteseo').'</option>
</select>
</td>
</tr>
<tr>
<th scope="row" style="use-select:auto;">'.esc_html__('Text alignment','siteseo').'</th>
<td>
<select name="siteseo_options[cd_txt_align]">
<option value="center" '.selected($option_cd_txt_align, 'center', false).'>'.esc_html__('Center (default)', 'siteseo').'</option>
<option value="left" '.selected($option_cd_txt_align, 'left', false).'>'.esc_html__('Left', 'siteseo').'</option>
<option value="right" '.selected($option_cd_txt_align, 'right', false).'>'.esc_html__('Right', 'siteseo').'</option>
</select>
</td>
</tr>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Cookie bar width', 'siteseo').'</th>
<td>
<input type="text" name="siteseo_options[cd_width]" value="'.esc_attr($option_cd_width).'"/>
<p class="description">'.esc_html__('The default unit is Pixels. To use percentages, simply add % after your custom value (e.g., 80%).', 'siteseo').'</p>
<br/>
<span class="line"></span>
</td>
</tr>
<tr>
<th scope="row" style="user-select:auto;"></th>
<td>
<h3>'.esc_html__('Backdrop', 'siteseo').'</h3>
<p>'.esc_html__('Customize the backdrop of the cookie bar.', 'siteseo').'</p><br/>
<label>
<input type="checkbox" name="siteseo_options[cd_backdrop]" '.(!empty($option_cd_backdrop) ? 'checked="yes"' : 'value="1"').'>'. esc_html__('Display a backdrop with the cookie bar', 'siteseo') .'
</label>
<br/><br/>
<p>'.esc_html__('Background color:','siteseo').'</p><br/>
<input type="color" placeholder="Select color" name="siteseo_options[backdrop_bg]" value="'.esc_attr($option_backdrop_bg).'"/>
<br/></br/>
<span class="line"></span>
</td>
</tr>
<tr>
<th scope="row" style="user-select:auto;"></th>
<td>
<h3>'.esc_html__('Main settings', 'siteseo').'</h3>
<p>'.esc_html__('Customize the general settings of the cookie bar', 'siteseo').'</p>
<p>'.esc_html__('Background color:', 'siteseo').'</p><br/>
<input type="color" placeholder="'.esc_html__('Select color', 'siteseo').'" name="siteseo_options[cookiesbar_bg]" value="'.esc_attr($option_cookiebar_bg).'"/>
<p>'.esc_html__('Text color:', 'siteseo').'</p><br/>
<input type="color" placeholder="'.esc_html__('Select color', 'siteseo').'" name="siteseo_options[cookiebar_txt]" value="'.esc_attr($option_cookiebar_txt).'"/>
<p>'.esc_html__('Link color: ','siteseo').'</p></br>
<input type="color" placeholder="'.esc_html__('Select color', 'siteseo').'" name="siteseo_options[line_co]" value="'.esc_attr($option_cookiebar_lk).'"/><br/></br>
<span class="line"></span>
</td>
</tr>
<tr>
<th scope="row" style="use-select:auto"></th>
<td>
<h3>'.esc_html__('Primary button', 'siteseo').'</h3>
<p>'.esc_html__('Customize the Accept button', 'siteseo').'</p><br/>
<p>'.esc_html__('Background color:', 'siteseo').'</p>
<input type="color" placeholder="'.esc_html__('Select color', 'siteseo').'" name="siteseo_options[primary_btn_bg]" value="'.esc_attr($option_primarybtn_bg).'"/><br/><br/>
<p>'.esc_html__('Background color on hover:','siteseo').'</p>
<input type="color" name="siteseo_options[primary_btn_bg_hov]" value="'.esc_attr($option_primarybtn_bg_hov).'" /><br/><br/>
<p>'.esc_html__('Text color:', 'siteseo').'</p>
<input type="color" name="siteseo_options[primary_btn_txt]" value="'.esc_attr($option_primarybtn_txt).'"/>
<p>'. esc_html__('Text color on hover:', 'siteseo') .'</p>
<input type="color" name="siteseo_options[primary_btn_txt_hov]" value="'.esc_attr($option_primarybtn_txt_hov).'"/><br/><br/>
<span class="line"></span>
</td>
</tr>
<tr>
<th scope="row" style="user-select:auto"></th>
<td>
<h3>'.esc_html__('Secondary button', 'siteseo').'</h3>
<p>'.esc_html__('Customize the Accept button', 'siteseo').'</p><br/>
<p>'.esc_html__('Background color:', 'siteseo').'</p>
<input type="color" placeholder="'.esc_html__('Select color','siteseo').'" name="siteseo_options[sec_btn_bg]" value="'.esc_attr($option_sec_bg).'"/><br/><br/>
<p>'.esc_html__('Background color on hover:', 'siteseo').'</p>
<input type="color" name="siteseo_options[sec_btn_bg_hov]" value="'.esc_attr($option_sec_bg_hov).'"/><br/><br/>
<p>'.esc_html__('Text color:', 'siteseo').'</p>
<input type="color" name="siteseo_options[sec_btn_txt]" value="'.esc_attr($option_sec_bg_txt).'"/>
<p>'.esc_html__('Text color on hover:', 'siteseo').'</p>
<input type="color" name="siteseo_options[sec_btn_txt_hov]" value="'.esc_attr($option_sec_bg_txt_hov).'"/>
</td>
</tr>
</tbody>
</table><input type="hidden" name="siteseo_options[cookies_tab]" value="1"/>';
}
static function matomo(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
//$options = $siteseo->analaytics_settings;
$options = get_option('siteseo_google_analytics_option_name');
$option_enable_matomo = !empty($options['google_analytics_matomo_enable']) ? $options['google_analytics_matomo_enable'] : '';
$option_self_hosted = !empty($options['google_analytics_matomo_self_hosted']) ? $options['google_analytics_matomo_self_hosted'] : '';
$option_matomo_id = !empty($options['google_analytics_matomo_id']) ? $options['google_analytics_matomo_id'] : '';
$option_site_id = !empty($options['google_analytics_matomo_site_id']) ? $options['google_analytics_matomo_site_id'] : '';
$option_sub_domain = !empty($options['google_analytics_matomo_subdomains']) ? $options['google_analytics_matomo_subdomains'] : '';
$option_site_domain = !empty($options['google_analytics_matomo_site_domain']) ? $options['google_analytics_matomo_site_domain'] : '';
$option_enable_corss_domain = !empty($options['google_analytics_matomo_cross_domain']) ? $options['google_analytics_matomo_cross_domain'] : '';
$option_no_js = !empty($options['google_analytics_matomo_no_js']) ? $options['google_analytics_matomo_no_js'] : '';
$option_cross_domain_sites = !empty($options['google_analytics_matomo_cross_domain_sites']) ? $options['google_analytics_matomo_cross_domain_sites'] : '';
$option_no_cookies = !empty($options['google_analytics_matomo_no_cookies']) ? $options['google_analytics_matomo_no_cookies'] : '';
$options_link_tracking = !empty($options['google_analytics_matomo_link_tracking']) ? $options['google_analytics_matomo_link_tracking'] : '';
$options_no_heatmaps = !empty($options['google_analytics_matomo_no_heatmaps']) ? $options['google_analytics_matomo_no_heatmaps'] : '';
$options_matomo_dtn = !empty($options['google_analytics_matomo_dnt']) ? $options['google_analytics_matomo_dnt'] : '';
$matomo_subtabs = [
'tracking' => 'Tracking',
];
echo '<table class="form-table">
<tbody>
<tr>
<th scope="row">
<div class="siteseo-container">';
$is_first = true;
foreach($matomo_subtabs as $post_key => $post_val){
$active_class = $is_first ? 'active' : '';
echo '<a href="#'.esc_attr($post_key).'" class="'.esc_attr($active_class).'">'.esc_html($post_val).'</a>';
$is_first = false;
}
echo '</div>
</th>
<td>
<h3>'.esc_html__('Matomo', 'siteseo').'</h3>
<div class="siteseo_wrap_label" id="tracking">
<p class="description">'.esc_html__('Track your users with privacy in mind using Matomo. We support both On-Premise and Cloud installations.', 'siteseo').'</p>
</div>
<span class="line"></span>
<h3>'.esc_html__('Tracking', 'siteseo').'</h3>
<table class="form-table">
<tbody>
<tr>
<th scope="row">'.esc_html__('Enable Matomo tracking.', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[enable_matomo]" '.(!empty($option_enable_matomo) ? 'checked="yes"' : '').' value="1"/>
'.esc_html__('Enable Matomo tracking', 'siteseo') .'
</label>
<p class="description">'.esc_html__('A Matomo Cloud account or a self-hosted Matomo installation is necessary.', 'siteseo').'</p>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Self hosted Matomo installation.', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[self_hosted]" '.(!empty($option_self_hosted) ? 'checked="yes"' : '').' value="1" "/>
'.esc_html__('Yes, self-hosted installation', 'siteseo').'
</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enter your tracking ID', 'siteseo').'</th>
<td>
<input type="text" placeholder="'.esc_html__('Enter "example" if you Matomo account URL is "example.matomo.cloud', 'siteseo').'" name="siteseo_options[tracking_id]" value="'.esc_attr($option_matomo_id).'"/>
'.wp_kses_post('<p class="description">Enter only the host without quotes, such as "example.matomo.cloud" </br> (Cloud) or "matomo.example.com" (self-hosted).</p>').'
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enter your site ID.', 'siteseo').'</th>
<td>
<input type="text" placeholder="'.esc_html__('Enter your site ID', 'siteseo').'" name="siteseo_options[site_id]" value="'.esc_attr($option_site_id).'"/>
<p class="description">'.
/* translators: placeholders are just <strong> tag */
wp_kses_post(sprintf(__('To find your site ID, visit your %1$s Matomo Cloud %2$s account, go to Websites, and click Manage. The <br/>"Site ID" will be displayed on the right side.', 'siteseo'), '<strong>', '</strong>')).'</p>
<p class="description">'.
/* translators: placeholder is just <br> tag */
wp_kses_post(sprintf(__('For self-hosted installations, navigate to your Matomo administration, then go to Settings, Websites, %1$s and Manage. From the list of websites, locate the "ID" line.', 'siteseo'), '<br/>')).'<p>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Track visitors across all subdomains', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[track_visitors]" '.(!empty($option_sub_domain) ? 'checked="yes"' : '').' value="1"/>
'.esc_html__('Monitor one domain along with its subdomains on the same website.','siteseo') .'
<p class=description">'.esc_html__('If a visitor visits x.example.com and y.example.com, they will be counted as a single unique visitor.', 'siteseo').'</p>
</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Prepend the site domain.', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[site_domain]" '.(!empty($option_site_domain) ? 'checked="yes"' : '').' value="1" />
'.esc_html__('Add the site domain before the page title when tracking', 'siteseo').'
<p class="description">For example, if someone visits the About page on blog.example.com, it will be recorded as "blog / About".<br/> This provides a simple way to get an overview of your traffic by subdomain.</p>`
</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Track users with JavaScript disabled.', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[track_users]" '.(!empty($option_no_js) ? 'checked="yes"' : '').' value="1" />
'. esc_html__('Track users with JavaScript disabled', 'siteseo').'
</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enables cross domain linking', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[enable_cross_domains]" '.(!empty($option_enable_corss_domain) ? 'checked="yes"' : '').' value="1" />
'.esc_html__('Enables cross domain linking', 'siteseo').'
</label>
<p class="description">'.esc_html__('By default, the visitor ID, which uniquely identifies each visitor, is stored in the browser first-party cookies. These cookies can only be accessed by pages on the same domain.', 'siteseo').'</p>
<p class="description">'.esc_html__('Enabling cross-domain tracking allows you to monitor all actions and pageviews of a specific visitor within the same session, even when they visit pages across different domains.', 'siteseo').'</p>
<p class="description">'.esc_html__('When a user clicks on a link to one of your site alias URLs, a URL parameter, <code>pk_vid</code>, will be appended, forwarding the Visitor ID.', 'siteseo').'</p>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Cross domain', 'siteseo').'</th>
<td>
<input type="text" name="siteseo_options[corss_domains]" value="'.esc_attr($option_cross_domain_sites).'" placeholder="'.esc_attr('Enter your domains: siteseo.io,sub.siteseo.io,sub2.siteseo.io').'"/>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enable DoNotTrack detection', 'siteseo').'</th>
<td>
<input type="checkbox" name="siteseo_options[enable_donottack]" '.(!empty($options_matomo_dtn) ? 'checked="yes"' : '').' value="1"/>
'.esc_html__('Activate client-side Do Not Track detection.', 'siteseo').'
<p class="description">'.esc_html__('Tracking requests will be blocked if visitors opt out of being tracked.', 'siteseo').'</p>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Disable all tracking cookies.', 'siteseo').'</th>
<td>
<input type="checkbox" name="siteseo_options[disabled_cookies]" '.(!empty($option_no_cookies) ? 'checked="yes"' : '').' value="1" />
'.esc_html__('Disables all first-party cookies. Any existing Matomo cookies for this site will be deleted on the next page view.', 'siteseo').'
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Download & Outlink tracking.', 'siteseo').'</th>
<td>
<input type="checkbox" name="siteseo_options[outlink_tracking]" '.(!empty($options_link_tracking) ? 'checked="yes"' : '').' value="1" />
'.esc_html__('Enabling Download & Outlink tracking','siteseo').'
<p class="description">By default, files with any of these extensions will be treated as a "download" in the Matomo interface.<p>
<div class="siteseo-styles pre"><pre>7z|aac|arc|arj|apk|asf|asx|avi|bin|bz|bz2|csv|deb|dmg|doc|exe|flv|gif|gz|gzip|hqx|jar|jpg|jpeg|js|mp2|mp3|mp4|mpg|mpeg|mov|movie|msi|msp|odb|odf|odg|odp|ods|odt|ogg|ogv| pdf|phps|png|ppt|qt|qtm|ra|ram|rar|rpm|sea|sit|tar|tbz|tbz2|tgz|torrent|txt|wav|wma|wmv|wpd|xls|xml|z|zip</pre></div>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Disable all heatmaps and session recordings.', 'siteseo').'</th>
<td>
<input type="checkbox" '.(!empty($options_no_heatmaps) ? 'checked="yes"' : '').' value="1" name="siteseo_options[disabled_heatmaps]" />
'.esc_html__('Turns off all heatmaps and session recordings.', 'siteseo').'
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table><input type="hidden" name="siteseo_options[matomo_tab]" value="1"/>';
}
static function advanced(){
global $siteseo,$wp_roles;
if(!empty($_POST['submit'])){
self::save_settings();
}
if(!isset($wp_roles)){
$wp_roles = new \WP_Roles();
}
//$options = $siteseo->analaytics_settings;
$options = get_option('siteseo_google_analytics_option_name');
$option_track_authors = !empty($options['google_analytics_cd_author']) ? $options['google_analytics_cd_author'] : '';
$option_track_categories = !empty($options['google_analytics_cd_category']) ? $options['google_analytics_cd_category'] : '';
$option_track_tag = !empty($options['google_analytics_cd_tag']) ? $options['google_analytics_cd_tag'] : '';
$option_track_post_types = !empty($options['google_analytics_cd_post_type']) ? $options['google_analytics_cd_post_type'] : '';
$option_logged_user = !empty($options['google_analytics_cd_logged_in_user']) ? $options['google_analytics_cd_logged_in_user'] : '';
$adavnced_subtabs =[
'custom-dimensions' => 'Custom Dimensions',
'Misc' => 'Misc',
];
echo '<table class="form-table">
<tbody>
<tr>
<th scope="row">
<div class="siteseo-container">';
$is_first = true;
foreach($adavnced_subtabs as $post_key => $post_val){
$active_class = $is_first ? 'active' : '';
echo '<a href="#'.esc_attr($post_key).'" class="'.esc_attr($active_class).'">'.esc_html($post_val).'</a>';
$is_first = false;
}
echo '</div>
</th>
<td>
<h3>'.esc_html__('Advanced settings', 'siteseo').'</h3>
<div class="siteseo-notice" id="custom-dimensions">
<span class="dashicons dashicons-info"></span>
<p>'.esc_html__('All advanced settings are compatible with both Google Analytics and Matomo tracking codes.', 'siteseo').'</p>
</div>
<br/>
<span class="line"></span>
<h3>'.esc_html__('Custom Dimensions', 'siteseo').'</h3>
<div class="siteseo_wrap_label"><p class="description">'.esc_html__('Set up your Google Analytics custom dimensions.', 'siteseo').'</p></div>
<div class="siteseo_wrap_label"><p class="description">'.esc_html__('Custom dimensions and metrics are similar to the default ones in Google Analytics, but you have the flexibility to create your own.', 'siteseo').'</p></div>
<div class="description"><p class="description">'.esc_html__('Utilize custom dimensions to gather and analyze data that Google Analytics does not track automatically.', 'siteseo').'</p></div>
<div class="description"><p class="description">'.esc_html__('Remember, you must also configure your custom dimensions in your Google Analytics account. Click the help icon for more information.', 'siteseo').'</p></div>
<table class="form-table">
<tbody>
<tr>
<th scope="row">'.esc_html__('Track Authors', 'siteseo').'</th>
<td>
<select name="siteseo_options[track_authors]">
<option value="none" '.selected($option_track_authors, 'none', false).'>'.esc_html__('None','siteseo').'</option>';
for($i = 1; $i <= 20; ++$i){
/* translators: %d represents the custom dimension */
echo '<option '.selected($option_track_authors, 'dimension' . $i, false).' value="dimension'.esc_attr($i).'">'.sprintf(esc_html__('Custom Dimension #%d', 'siteseo'), esc_html($i)).'</option>';
}
echo '</select>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Track Categories', 'siteseo').'</th>
<td>
<select name="siteseo_options[track_categories]">
<option value="none" '.selected($option_track_categories, 'none', false).'>'.esc_html__('None','siteseo').'</option>';
for($i = 1; $i <= 20; ++$i){
/* translators: %d represents the custom dimension */
echo '<option '.selected($option_track_categories, 'dimension' . $i, false).' value="dimension'.esc_attr($i).'">'.sprintf(esc_html__('Custom Dimension #%d', 'siteseo'), esc_html($i)).'</option>';
}
echo '</select>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Track Tags', 'siteseo').'</th>
<td>
<select name="siteseo_options[track_tags]">
<option value="none" '.selected($option_track_tag, 'none', false).'>'.esc_html__('None','siteseo').'</option>';
for($i = 1; $i <= 20; ++$i){
/* translators: %d represents the custom dimension */
echo '<option '.selected($option_track_tag, 'dimension' . $i, false).' value="dimension'.esc_attr($i).'">'.sprintf(esc_html__('Custom Dimension #%d', 'siteseo'), esc_html($i)).'</option>';
}
echo '</select>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Track Post Types','siteseo').'</th>
<td>
<select name="siteseo_options[track_post_types]">
<option value="none" '.selected($option_track_post_types, 'none', false).'>'.esc_html__('None','siteseo').'</option>';
for($i = 1; $i <= 20; ++$i){
/* translators: %d represents the custom dimension */
echo '<option '.selected($option_track_post_types, 'dimension' . $i, false).' value="dimension'.esc_attr($i).'">'.sprintf(esc_html__('Custom Dimension #%d', 'siteseo'), esc_html($i)).'</option>';
}
echo '</select>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Track Logged In Users','siteseo').'</th>
<td>
<select name="siteseo_options[track_user]">
<option value="none" '.selected($option_logged_user, 'none', false).'>'.esc_html__('None','siteseo').'</option>';
for($i = 1; $i <= 20; ++$i){
/* translators: %d represents the custom dimension */
echo '<option '.selected($option_logged_user, 'dimension' . $i, false).' value="dimension'.esc_attr($i).'">'. sprintf(esc_html__('Custom Dimension #%d', 'siteseo'), esc_html($i)).'</option>';
}
echo '</select>
</td>
</tr>
</tbody>
</table>
<div class="description" id="Misc"><span class="line"></span>
<h3>'.esc_html__('Misc','siteseo').'</h3>
<table>
<tbody class="form-table">
<tr>
<th scope="row">'.esc_html__('Exclude user roles from tracking (Google Analytics and Matomo)','siteseo').'</th>
<td>';
foreach($wp_roles->get_names() as $key => $value){
$select = isset($options['google_analytics_roles'][$key]);
echo '<p>
<label>
<input name="siteseo_options[misc_roles]['.esc_attr($key).']" type="checkbox" '.(!empty($select) ? 'checked="yes"' : 'value="1"').'/>
<strong>'. esc_html($value) .'</strong> (<em> '. esc_html(translate_user_role($value, 'default')) .'</em>)
</label>
</p>';
}
echo '</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table><input type="hidden" name="siteseo_options[advanced_tab]" value="1"/>';
}
static function clarity(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
//$options = $siteseo->analaytics_settings;
$options = get_option('siteseo_google_analytics_option_name');
$option_enable_clarity = !empty($options['google_analytics_clarity_enable']) ? $options['google_analytics_clarity_enable'] : '';
$option_project_id = !empty($options['google_analytics_clarity_project_id']) ? $options['google_analytics_clarity_project_id'] : '';
echo '<h3 class="siteseo-tabs">'.esc_html__('Microsoft Clarity', 'siteseo').'</h3>
<p class="description">'.esc_html__('Use Microsoft Clarity to capture session recordings, access instant heatmaps, and gain powerful insights for free. Understand how users interact with your site to enhance the user experience and boost conversions.', 'siteseo').'</p>
<div class="siteseo-notice">
<span class="dashicons dashicons-info"></span>
<p>'.
/* translators: %s represents the microsoft clarity api url */
wp_kses_post(sprintf(__('Create your first Microsoft Clarity project %1$shere%2$s.', 'siteseo'), '<a href="https://clarity.microsoft.com/" target="_blank">', '</a>')) .'</p>
</div>
<table class="form-table">
<tbody>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Enable Microsoft Clarity','siteseo').'</th>
<td>
<input type="checkbox" name="siteseo_options[microsoft_clarity]" '.(!empty($option_enable_clarity) ? 'checked="yes"' : ''). ' value="1">
</td>
</tr>
<tr>
<th scope="row" style="user-select:auto;">'.esc_html__('Enter your Clarity project ID', 'siteseo').'</th>
<td>
<input type="text" name="siteseo_options[project_id]" placeholder="'.esc_attr__('Enter your Project Id', 'siteseo').'" value="'.esc_attr($option_project_id).'" >
<p><span class="dashicons dashicons-external"></span>
<a href="https://siteseo.io/docs/analytics/find-my-microsoft-clarity-project-id/" target="_blank">
'.esc_html__('Find your project ID', 'siteseo').'
</a>
</span>
</p>
</td>
</tr>
</tbody>
</table><input type="hidden" name="siteseo_options[clarity_tab]" value="1" />';
}
static function google_anlytics(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
$options = get_option('siteseo_google_analytics_option_name');
//$options = $siteseo->analaytics_settings;
$option_enable_anaytics = !empty($options['google_analytics_enable']) ? $options['google_analytics_enable'] : '';
$option_anaytics_id = !empty($options['google_analytics_ga4']) ? $options['google_analytics_ga4'] : '';
$option_enable_optimize = !empty($options['google_analytics_link_tracking_enable']) ? $options['google_analytics_link_tracking_enable'] : '';
$option_enable_download_tracking= !empty($options['google_analytics_download_tracking_enable']) ? $options['google_analytics_download_tracking_enable'] : '';
$option_download_tracking = !empty($options['google_analytics_download_tracking']) ? $options['google_analytics_download_tracking'] : '';
$option_affiliate_tracking_enable = !empty($options['google_analytics_affiliate_tracking_enable']) ? $options['google_analytics_affiliate_tracking_enable'] : '';
$option_affiliate_tracking = !empty($options['google_analytics_affiliate_tracking']) ? $options['google_analytics_affiliate_tracking'] : '';
$option_phone_tracking = !empty($options['google_analytics_phone_tracking']) ? $options['google_analytics_phone_tracking'] : '';
$option_container_id = !empty($options['google_analytics_optimize']) ? $options['google_analytics_optimize'] : '';
$option_conversion_id = !empty($options['google_analytics_ads']) ? $options['google_analytics_ads'] : '';
$option_ip_anonymization = !empty($options['google_analytics_ip_anonymization']) ? $options['google_analytics_ip_anonymization'] : '';
$option_links_attribution = !empty($options['google_analytics_link_attribution']) ? $options['google_analytics_link_attribution'] : '';
$option_domain_tracking = !empty($options['google_analytics_cross_enable']) ? $options['google_analytics_cross_enable'] : '';
$option_cross_domain = !empty($options['google_analytics_cross_domain']) ? $options['google_analytics_cross_domain'] : '';
$option_enable_remarketing = !empty($options['google_analytics_remarketing']) ? $options['google_analytics_remarketing'] : '';
$google_analytics_fileds = [
'general-settings' =>'General',
'tracking-settings'=>'Tracking',
'events-settings' => 'Events'
];
echo '<table class="form-table">
<tbody>
<tr>
<th scope="row">
<div class="siteseo-container">';
$is_first = true;
foreach($google_analytics_fileds as $post_key => $post_val){
$active_class = $is_first ? 'active' : '';
echo '<a href="#'.esc_attr($post_key).'" class="'.esc_attr($active_class).'">'.esc_html($post_val).'</a>';
$is_first = false;
}
echo '</div></th>
<td>
<div id="general-settings">
<h3>'.esc_html__('Google Anlytics', 'siteseo').'</h3>
<div class="siteseo_wrap_label"><p class="description">'.esc_html__('Connect your Google Analytics to your website. The tracking code will be automatically added to your site.', 'siteseo') .'</p></div>
<span class="line"></span>
<div class="siteseo_wrap_label"><p class="'.esc_html__('description">Link your Google Analytics to your website. The tracking code will be automatically added to your site', 'siteseo').'</p></div>
<span class="line"></span>
<table class="form-table">
<tbody>
<tr>
<th scope="row">'.esc_html__('General', 'siteseo').'</th>
<td></td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enable Google Analytics tracking', 'siteseo').'</th>
<td>
<label><input type="checkbox" name="siteseo_options[google_anlytics_tracking]" '.(!empty($option_enable_anaytics) ? 'checked="yes"' : '') . ' value="1"/> ' . esc_html__('Activate Google Analytics tracking using the Global Site Tag (gtag.js).', 'siteseo') . '</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enter your measurement ID (GA4)', 'siteseo').'</th>
<td>
<input type="text" placeholder="'.esc_attr__('Enter your measurement ID (G-XXXXXXXXXX)','siteseo').'" name="siteseo_options[anlytics_measurement_id]" value="'.esc_attr($option_anaytics_id).'">
<p>
<span class="dashicons dashicons-external"></span>
<a href="https://support.google.com/analytics/answer/9539598?hl=en&ref_topic=9303319" target="_blank">'.esc_html__('Find your measurement ID', 'siteseo').'</a>
</p>
</td>
</tr>
</tbody>
</table>
</div></div>
<div id="tracking-settings">
<span class="line"></span>
<h3>'.esc_html__('Tracking','siteseo').'</h3>
<p class="description">'.esc_html__('Set up your Google Analytics tracking code.', 'siteseo').'</P>
<table class="form-table">
<tbody>
<tr>
<th scope="row">'.esc_html__('Enable Google Optimize.', 'siteseo').'</th>
<td>
<label>
<input type="text" name="siteseo_options[container_id]" placeholder="'.esc_attr__('Enter your Google Optimize container ID.', 'siteseo').'" value="'.esc_attr($option_container_id).'"/>
</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enable Google Ads','siteseo').'</th>
<td>
<label>
<input type="text" placeholder="'.esc_attr__('Enter your Google Ads conversion ID (eg: AW-123456789).', 'siteseo').'" name="siteseo_options[conversion_id]" value="'.esc_attr($option_conversion_id).'"/>
</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enable remarketing, demographics, and interests reporting', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[enable_remarketing]" '.(!empty($option_enable_remarketing) ? 'checked="yes"' : '').' value="1"/>
'. esc_html__('Enable remarketing, demographics, and interests reporting', 'siteseo').'
</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enable IP Anonymization', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[ip_anonymiza]" '.(!empty($option_ip_anonymization) ? 'checked="yes"' : '').'/>
'. esc_html__('Enable IP Anonymization', 'siteseo') .'
</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enhanced Link Attribution', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[link_attribution]" '.(!empty($option_links_attribution) ? 'checked="yes"' : '').'/>
'. esc_html__('Enhanced Link Attribution', 'siteseo').'
</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enable cross-domain tracking', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[domain_tracking]" '.(!empty($option_domain_tracking) ? 'checked="yes"' : '').' />
'. esc_html__('Enable cross-domain tracking', 'siteseo').'
</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Cross domains', 'siteseo').'</th>
<td>
<input type="text" placeholder="Enter your domains: siteseo.io,sub.siteseo.io,sub2.siteseo.io" name="siteseo_options[cross_domain]" value="'.esc_attr($option_cross_domain).'" />
</td>
</tr>
</tbody>
<table>
</div>
<div id="events-settings">
<span class="line"></span>
<h3>'.esc_html__('Events', 'siteseo').'</h3>
<P class="description">'.esc_html__('Track events in Google Analytics', 'siteseo').'</p>
<table class="form-table">
<tbody>
<tr>
<th scope="row">'.esc_html__('Enable Google Optimize', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[google_optimize]" '.(!empty($option_enable_optimize) ? 'checked="yes"' : ''). ' value="1">' . esc_html__(' Enable external links tracking', 'siteseo') . '
</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enable downloads tracking (eg: PDF, XLSX, DOCX...)', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[enable_download_tracking]" '.(!empty($option_enable_download_tracking) ? 'checked="yes"' : '').' value="1"> '.esc_html__('Enable download tracking', 'siteseo').'
</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Track downloads clicks', 'siteseo').'</th>
<td>
<input type="text" placeholder="pdf|docs|pptx|zip" name="siteseo_options[track_downlaods]" value="'.esc_attr($option_download_tracking).'"/>
<p class="description">'.esc_html__('Separate each file type extensions with a pipe "|"','siteseo').'</p>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Enable affiliate/outbound links tracking (eg: aff, go, out, recommends)', 'siteseo').'</th>
<td>
<label>
<input type="checkbox" name="siteseo_options[aff_tracking_enable]" '.(!empty($option_affiliate_tracking_enable ) ? 'checked="yes"' : '').' value="1"/>
'. esc_html__('Enable affiliate/outbound tracking','siteseo') .'</label>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Track affiliate/outbound links','siteseo').'</th>
<td>
<input type="text" name="siteseo_options[aff_tracking]" placeholder="aff|go|out" value="'.esc_attr($option_affiliate_tracking).'"/>
<p class="description">'.esc_html__('Separate each keyword with a pipe "|"', 'siteseo').'</p>
</td>
</tr>
<tr>
<th scope="row">'.esc_html__('Track phone links','siteseo').'</th>
<td>
<input type="checkbox" name="siteseo_options[track_phones]" '.(!empty($option_phone_tracking ) ? 'checked="yes"' : '') . ' value="1"/>
'.esc_html__(' Enable tracking of "tel:" links' , 'siteseo'). '
<div class="siteseo-styles pre"><pre>'.esc_html('<a href="tel:+33123456789">').'</pre></div>
</td>
</tr>
</tbody>
</table
</div>
</td>
</tbody>
</table>
<input type="hidden" name="siteseo_options[analytics_tab]" value="1"/>';
}
static function save_settings(){
global $siteseo;
check_admin_referer('siteseo_analytics_settings');
if(!siteseo_user_can('manage_analytics') || !is_admin()){
return;
}
$options = [];
if(empty($_POST['siteseo_options'])){
return;
}
if(isset($_POST['siteseo_options']['analytics_tab'])){
$options['google_analytics_enable'] = isset($_POST['siteseo_options']['google_anlytics_tracking']);
$options['google_analytics_ga4'] = isset($_POST['siteseo_options']['anlytics_measurement_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['anlytics_measurement_id'])) : '';
$options['google_analytics_link_tracking_enable'] = isset($_POST['siteseo_options']['google_optimize']);
$options['google_analytics_download_tracking_enable'] = isset($_POST['siteseo_options']['enable_download_tracking']);
$options['google_analytics_download_tracking'] = isset($_POST['siteseo_options']['track_downlaods']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['track_downlaods'])) : '';
$options['google_analytics_affiliate_tracking_enable'] = isset($_POST['siteseo_options']['aff_tracking_enable']);
$options['google_analytics_affiliate_tracking'] = isset($_POST['siteseo_options']['aff_tracking']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['aff_tracking'])) : '';
$options['google_analytics_phone_tracking'] = isset($_POST['siteseo_options']['track_phones']);
$options['google_analytics_optimize'] = isset($_POST['siteseo_options']['container_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['container_id'])) : '';
$options['google_analytics_ads'] = isset($_POST['siteseo_options']['conversion_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['conversion_id'])) : '';
$options['google_analytics_remarketing'] = isset($_POST['siteseo_options']['enable_remarketing']);
$options['google_analytics_ip_anonymization'] = isset($_POST['siteseo_options']['ip_anonymiza']);
$options['google_analytics_link_attribution'] = isset($_POST['siteseo_options']['link_attribution']);
$options['google_analytics_cross_enable'] = isset($_POST['siteseo_options']['domain_tracking']);
$options['google_analytics_cross_domain'] = isset($_POST['siteseo_options']['cross_domain']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cross_domain'])) : '';
}
if(isset($_POST['siteseo_options']['clarity_tab'])){
$options['google_analytics_clarity_enable'] = isset($_POST['siteseo_options']['microsoft_clarity']);
$options['google_analytics_clarity_project_id'] = isset($_POST['siteseo_options']['project_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['project_id'])) : '';
}
if(isset($_POST['siteseo_options']['matomo_tab'])){
$options['google_analytics_matomo_enable'] = isset($_POST['siteseo_options']['enable_matomo']);
$options['google_analytics_matomo_self_hosted'] = isset($_POST['siteseo_options']['self_hosted']);
$options['google_analytics_matomo_id'] = isset($_POST['siteseo_options']['tracking_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['tracking_id'])) : '';
$options['google_analytics_matomo_site_id'] = isset($_POST['siteseo_options']['site_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['site_id'])) : '';
$options['google_analytics_matomo_subdomains'] = isset($_POST['siteseo_options']['track_visitors']);
$options['google_analytics_matomo_site_domain'] = isset($_POST['siteseo_options']['site_domain']);
$options['google_analytics_matomo_cross_domain'] = isset($_POST['siteseo_options']['enable_cross_domains']);
$options['google_analytics_matomo_no_js'] = isset($_POST['siteseo_options']['track_users']);
$options['google_analytics_matomo_cross_domain_sites'] = isset($_POST['siteseo_options']['corss_domains']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['corss_domains'])) : '';
$options['google_analytics_matomo_no_cookies'] = isset($_POST['siteseo_options']['disabled_cookies']);
$options['google_analytics_matomo_link_tracking'] = isset($_POST['siteseo_options']['outlink_tracking']);
$options['google_analytics_matomo_no_heatmaps'] = isset($_POST['siteseo_options']['disabled_heatmaps']);
$options['google_analytics_matomo_dnt'] = isset($_POST['siteseo_options']['enable_donottack']);
}
if(isset($_POST['siteseo_options']['advanced_tab'])){
$options['google_analytics_cd_author'] = isset($_POST['siteseo_options']['track_authors']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['track_authors'])) : '';
$options['google_analytics_cd_category'] = isset($_POST['siteseo_options']['track_categories']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['track_categories'])) : '';
$options['google_analytics_cd_tag'] = isset($_POST['siteseo_options']['track_tags']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['track_tags'])) : '';
$options['google_analytics_cd_post_type'] = isset($_POST['siteseo_options']['track_post_types']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['track_post_types'])) : '';
$options['google_analytics_cd_logged_in_user'] = isset($_POST['siteseo_options']['track_user']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['track_user'])) : '';
// mics roles
if(isset($_POST['siteseo_options']['misc_roles'])){
$options['google_analytics_roles'] = map_deep(wp_unslash($_POST['siteseo_options']['misc_roles']), 'sanitize_text_field');
}
}
if(isset($_POST['siteseo_options']['custom_tracking_tab']) && current_user_can('unfiltered_html')){
// NOTE: These options can not be sanitized as we need user to be able to add some JS code, so we have added a capability check which only a super admin can have.
$options['google_analytics_other_tracking'] = isset($_POST['siteseo_options']['head_tracking']) ? wp_unslash($_POST['siteseo_options']['head_tracking']) : '';
$options['google_analytics_other_tracking_body'] = isset($_POST['siteseo_options']['body_tracking']) ? wp_unslash($_POST['siteseo_options']['body_tracking']) : '';
$options['google_analytics_other_tracking_footer'] = isset($_POST['siteseo_options']['footer_tracking']) ? wp_unslash($_POST['siteseo_options']['footer_tracking']) : '';
}
if(isset($_POST['siteseo_options']['cookies_tab'])){
$options['google_analytics_hook'] = isset($_POST['siteseo_options']['cookie_pos']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cookie_pos'])) : '';
$options['google_analytics_disable'] = isset($_POST['siteseo_options']['opt_tracking']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['opt_tracking'])) : '';
$options['google_analytics_half_disable'] = isset($_POST['siteseo_options']['half_disable']);
$options['google_analytics_opt_out_edit_choice'] = isset($_POST['siteseo_options']['opt_edit_choices']);
$options['google_analytics_opt_out_msg'] = isset($_POST['siteseo_options']['opt_msg']) ? wp_kses_post(wp_unslash($_POST['siteseo_options']['opt_msg'])) : 'We use cookies to enhance your experience.';
$options['google_analytics_opt_out_msg_ok'] = isset($_POST['siteseo_options']['opt_msg_ok']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['opt_msg_ok'])) : 'Accept';
$options['google_analytics_opt_out_msg_edit'] = isset($_POST['siteseo_options']['opt_edit_btn']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['opt_edit_btn'])) : 'Manage cookies';
$options['google_analytics_opt_out_msg_close'] = isset($_POST['siteseo_options']['opt_close']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['opt_close'])) : 'X';
$options['google_analytics_cb_exp_date'] = isset($_POST['siteseo_options']['cd_exp_date']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cd_exp_date'])) : '30';
$options['google_analytics_cb_pos'] = isset($_POST['siteseo_options']['cd_pos']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cd_pos'])) : 'center';
$options['google_analytics_cb_txt_align'] = isset($_POST['siteseo_options']['cd_txt_align']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cd_txt_align'])) : 'center';
$options['google_analytics_cb_width'] = isset($_POST['siteseo_options']['cd_width']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cd_width'])) : '100%';
$options['google_analytics_cb_scheme'] = isset($_POST['siteseo_options']['google_analytics_cb_scheme']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['google_analytics_cb_scheme'])) : '';
// Colors
$options['google_analytics_cb_backdrop'] = isset($_POST['siteseo_options']['cd_backdrop']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cd_backdrop'])) : '';
$options['google_analytics_cb_backdrop_bg'] = isset($_POST['siteseo_options']['backdrop_bg']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['backdrop_bg'])) : '';
$options['google_analytics_cb_bg'] = isset($_POST['siteseo_options']['cookiesbar_bg']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cookiesbar_bg'])) : '';
$options['google_analytics_cb_txt_col'] = isset($_POST['siteseo_options']['cookiebar_txt']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['cookiebar_txt'])) : '';
$options['google_analytics_cb_lk_col'] = isset($_POST['siteseo_options']['line_co']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['line_co'])) : '';
$options['google_analytics_cb_btn_bg'] = isset($_POST['siteseo_options']['primary_btn_bg']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['primary_btn_bg'])) : '';
$options['google_analytics_cb_btn_bg_hov'] = isset($_POST['siteseo_options']['primary_btn_bg_hov']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['primary_btn_bg_hov'])) : '';
$options['google_analytics_cb_btn_col'] = isset($_POST['siteseo_options']['primary_btn_txt']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['primary_btn_txt'])) : '';
$options['google_analytics_cb_btn_col_hov'] = isset($_POST['siteseo_options']['primary_btn_txt_hov']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['primary_btn_txt_hov'])) : '';
$options['google_analytics_cb_btn_sec_bg'] = isset($_POST['siteseo_options']['sec_btn_bg']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['sec_btn_bg'])) : '';
$options['google_analytics_cb_btn_sec_bg_hov'] = isset($_POST['siteseo_options']['sec_btn_bg_hov']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['sec_btn_bg_hov'])) : '';
$options['google_analytics_cb_btn_sec_col'] = isset($_POST['siteseo_options']['sec_btn_txt']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['sec_btn_txt'])) : '';
$options['google_analytics_cb_btn_sec_col_hov'] = isset($_POST['siteseo_options']['sec_btn_txt_hov']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['sec_btn_txt_hov'])) : '';
}
update_option('siteseo_google_analytics_option_name', $options);
}
}
<?php
/*
* SITESEO
* https://siteseo.io
* (c) SiteSEO Team
*/
namespace SiteSEO\Settings;
if(!defined('ABSPATH')){
die('HACKING ATTEMPT!');
}
class Dashboard{
static function dashboard_tab(){
global $siteseo;
$pro = get_option('siteseo_pro_options');
$options = $siteseo->setting_enabled;
$titles_meta_toggle = isset($options['toggle-titles']) ? $options['toggle-titles'] : '';
$sitemap_toggle = isset($options['toggle-xml-sitemap']) ? $options['toggle-xml-sitemap'] : '';
$social_toggle = isset($options['toggle-social']) ? $options['toggle-social'] : '';
$advanced_toggle = isset($options['toggle-advanced']) ? $options['toggle-advanced'] : '';
$analytics_toggle = isset($options['toggle-google-analytics']) ? $options['toggle-google-analytics'] : '';
$indexing_toggle = isset($options['toggle-instant-indexing']) ? $options['toggle-instant-indexing'] : '';
//pro-features
$toggle_localBusiness = isset($pro['toggle_state_local_buz']) ? $pro['toggle_state_local_buz'] : '';
$toggle_easy_digital = isset($pro['toggle_state_easy_digital']) ? $pro['toggle_state_easy_digital'] : '';
$toggle_woocommerce = isset($pro['toggle_state_woocommerce']) ? $pro['toggle_state_woocommerce'] : '';
$toggle_structured_data = isset($pro['toggle_state_stru_data']) ? $pro['toggle_state_stru_data'] : '';
$toggle_state_redirect = isset($pro['toggle_state_redirect_monitoring']) ? $pro['toggle_state_redirect_monitoring'] : '';
$toggle_state_google_news = isset($pro['toggle_state_google_news']) ? $pro['toggle_state_google_news'] : '';
$toggle_state_video_sitemap = isset($pro['toggle_state_video_sitemap']) ? $pro['toggle_state_video_sitemap'] : '';
$toggle_state_llm_txt = isset($pro['toggle_state_llm_txt']) ? $pro['toggle_state_llm_txt'] : '';
$nonce = wp_create_nonce('siteseo_toggle_nonce');
$pro_nonce = wp_create_nonce('siteseo_pro_toggle_nonce');
$siteseo_dashboard_img = SITESEO_ASSETS_URL.'/img/seo-get-started.jpg';
$siteseo_loginizer_product = SITESEO_ASSETS_URL.'/img/loginizer_product.png';
echo'<div id="siteseo-root">';
Util::admin_header();
$dismissed_intro = get_option('siteseo_dismiss_intro', 0);
echo'<div id="siteseo-dashbord">';
if(empty($dismissed_intro) && !defined('SITEPAD')){
echo '<div class="siteseo-dashbord-intro">
<div class="siteseo-text-content">
<h2>'.esc_html__('HOW-TO GET STARTED', 'siteseo').'</h2><h1>'.esc_html__('Welcome to SiteSEO!', 'siteseo').'</h1>
<p>'.esc_html__('Launch our installation wizard to quickly and easily configure the basic SEO settings for your site. Cant find the answers to your questions? Write us at support@siteseo.io. A happiness engineer will be happy to help you.', 'siteseo').'</p>
<div class="siteseo-buttons">
<a class="get-started" href="?page=siteseo-onboarding">'.esc_html__('Get started', 'siteseo').'</a>
<a class="dismiss" id="siteseo-dismiss-get-started" href="#">'.esc_html__('Dismiss', 'siteseo').'</a>
</div>
</div>
<div class="siteseo-image-content"><img alt="'.esc_html__('Illustration of a megaphone with various icons representing SEO and digital marketing', 'siteseo').'" height="470" src="'.esc_url($siteseo_dashboard_img).'" width="470"/>
</div>
</div>';
}
echo '<div class="siteseo-dashbord-content">
<section class="siteseo-dashboard-features">
<h2>'.esc_html__('Manage SiteSEO Features', 'siteseo').'</h2></br/>
<div class="siteseo-dashbord-container">
<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-edit-large siteseo-card-icon"></span>
<h3>'.esc_html__('Titles & Metas', 'siteseo').'</h3>
<p>'.esc_html__('Manage all your titles and metas for post types, taxonomies more...', 'siteseo').'</p>
</div>
<div class="siteseo-card-footer">
<a href="admin.php?page=siteseo-titles">'.esc_html__('Settings', 'siteseo').'</a>';
Util::render_toggle('Titles & Metas -SiteSEO', 'titles_meta_toggle', $titles_meta_toggle, $nonce, true);
echo'</div>
</div>
<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-networking siteseo-card-icon"></span>
<h3>'.esc_html__('XML & HTML Sitemaps', 'siteseo').'</h3>
<p>'.esc_html__('Manage your XML - Image - Video- Taxonomies - HTML Sitemap more...', 'siteseo').'</p>
</div>
<div class="siteseo-card-footer">
<a href="admin.php?page=siteseo-sitemaps">'.esc_html__('Settings', 'siteseo').'</a>';
Util::render_toggle('Sitemaps - SiteSEO', 'sitemap_toggle', $sitemap_toggle, $nonce,true);
echo'</div>
</div>
<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-share siteseo-card-icon"></span>
<h3>'.esc_html__('Social Networks', 'siteseo').'</h3>
<p>'.esc_html__('Open Graph, X Card, Google Knowledge Graph and more...', 'siteseo').'</p>
</div>
<div class="siteseo-card-footer">
<a href="admin.php?page=siteseo-social">'.esc_html__('Settings','siteseo').'</a>';
Util::render_toggle('Social - SiteSEO', 'social_toggle', $social_toggle, $nonce,true);
echo'</div>
</div>
<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-performance siteseo-card-icon"></span>
<h3>'.esc_html__('Analytics', 'siteseo').'</h3>
<p>'.esc_html__('Track everything about your visitors with Analytics/Matomo more...', 'siteseo').'</p>
</div>
<div class="siteseo-card-footer">
<a href="admin.php?page=siteseo-analytics">'.esc_html__('Settings','siteseo').'</a>';
Util::render_toggle('Analytics - SiteSEO', 'analytics_toggle', $analytics_toggle, $nonce,true);
echo'</div>
</div>
<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-superhero siteseo-card-icon"></span>
<h3>'.esc_html__('Instant Indexing','siteseo').'</h3>
<p>'.esc_html__('Ping Google & Bing to quickly index your content. Updated and remove submit URLs','siteseo').'</p>
</div>
<div class="siteseo-card-footer">
<a href="admin.php?page=siteseo-instant-indexing">'.esc_html__('Settings','siteseo').'</a>';
Util::render_toggle('Instant indexing - SiteSEO', 'indexing_toggle', $indexing_toggle, $nonce,true);
echo'</div>
</div>
<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-format-gallery siteseo-card-icon"></span>
<h3>'.esc_html__('Image SEO','siteseo').'</h3>
<p>'.esc_html__('Optimize your images for SEO. Configure advanced settings more...','siteseo').'</p>
</div>
<div class="siteseo-card-footer">
<a href="admin.php?page=siteseo-advanced">'.esc_html__('Settings','siteseo').'</a>';
Util::render_toggle('Advanced - SiteSEO', 'advanced_toggle', $advanced_toggle, $nonce,true);
echo'</div>
</div>
<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-upload siteseo-card-icon"></span>
<h3>'.esc_html__('Tools', 'siteseo').'</h3>
<p>'.esc_html__('Import/Export plugin settings from site to site. Reset settings more...', 'siteseo').'</p>
</div>
<div class="siteseo-card-footer">
<a href="admin.php?page=siteseo-tools">'.esc_html__('Settings', 'siteseo').'</a>
<div class="siteseo-toggle-container">
</div>
</div>
</div>';
if(!defined('SITEPAD')){
echo'<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-cart siteseo-card-icon"></span>
<h3>'.esc_html__('WooCommerces SEO','siteseo'),'</h3>
<p>'.esc_html__('Add meta tags required for WooCommerce SEO','siteseo').'</p>
</div>
<div class="siteseo-card-footer">';
if(defined('SITESEO_PRO_VERSION')){
echo'<a href="admin.php?page=siteseo-pro-page">'.esc_html__('Settings','siteseo').'</a>';
} else{
echo'<div class="siteseo-pro-badge">Pro</div>';
}
if(class_exists('\SiteSEOPro\Settings\Util') && method_exists('\SiteSEOPro\Settings\Util', 'render_toggle')){
\SiteSEOPro\Settings\Util::render_toggle('woocommerce', $toggle_woocommerce, $pro_nonce, true);
}
echo'</div></div>';
echo '<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-money-alt siteseo-card-icon"></span>
<h3>'.esc_html__('Easy Digital Downloads', 'siteseo').'</h3>
<p>'.esc_html__('Add meta tags required for Easy Digitial Downloads SEO', 'siteseo').'</p>
</div>
<div class="siteseo-card-footer">';
if(defined('SITESEO_PRO_VERSION')){
echo'<a href="admin.php?page=siteseo-pro-page">'.esc_html__('Settings','siteseo').'</a>';
} else{
echo'<div class="siteseo-pro-badge">Pro</div>';
}
if(class_exists('\SiteSEOPro\Settings\Util') && method_exists('\SiteSEOPro\Settings\Util', 'render_toggle')){
\SiteSEOPro\Settings\Util::render_toggle('edd', $toggle_easy_digital, $pro_nonce,true);
}
echo'</div></div>';
}
echo '<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-code-standards siteseo-card-icon"></span>
<h3>'.esc_html__('Page Speed', 'siteseo').'</h3>
<p>'.esc_html__('Enhance Your Website Performance with PageSpeed Insights','siteseo').'</p>
</div>
<div class="siteseo-card-footer">';
if(defined('SITESEO_PRO_VERSION')){
echo'<a href="admin.php?page=siteseo-pro-page">'.esc_html__('Settings', 'siteseo').'</a>';
} else {
echo'<div class="siteseo-pro-badge">Pro</div>';
}
echo'</div>
</div>
<div class="siteseo-card">
'.((time() < strtotime('30 November 2025')) ? '<span class="siteseo-feature-update-badge">Updated</span>' : '') .'
<div class="siteseo-card-body">
<span class="dashicons dashicons-list-view siteseo-card-icon"></span>
<h3>'.esc_html__('Structured Data','siteseo').'</h3>
<p>'.esc_html__('Enhance Search Visibility with Structured Data Optimization','siteseo').'</p>
</div>
<div class="siteseo-card-footer">';
if(defined('SITESEO_PRO_VERSION')){
echo'<a href="admin.php?page=siteseo-pro-page">'.esc_html__('Settings', 'siteseo').'</a>';
} else{
echo'<div class="siteseo-pro-badge">Pro</div>';
}
if(class_exists('\SiteSEOPro\Settings\Util') && method_exists('\SiteSEOPro\Settings\Util', 'render_toggle')){
\SiteSEOPro\Settings\Util::render_toggle('structured', $toggle_structured_data, $pro_nonce,true);
}
echo'</div>
</div>
<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-location siteseo-card-icon"></span>
<h3>'.esc_html__('Local Business', 'siteseo').'</h3>
<p>'.esc_html__('Optimize Your Online Presence for Local Business Success', 'siteseo').'</p>
</div>
<div class="siteseo-card-footer">';
if(defined('SITESEO_PRO_VERSION')){
echo '<a href="admin.php?page=siteseo-pro-page">'.esc_html__('Settings', 'siteseo').'</a>';
} else{
echo'<div class="siteseo-pro-badge">Pro</div>';
}
if(class_exists('\SiteSEOPro\Settings\Util') && method_exists('\SiteSEOPro\Settings\Util', 'render_toggle')){
\SiteSEOPro\Settings\Util::render_toggle('local', $toggle_localBusiness, $pro_nonce, true);
}
echo'</div>
</div>
<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-editor-unlink siteseo-card-icon"></span>
<h3>'.esc_html__('Redirections / 404 monitoring','siteseo').'</h3>
<p>'.esc_html__('Track 404 errors and set up redirects to improve user experience and SEO.','siteseo').'</p>
</div>
<div class="siteseo-card-footer">';
if(defined('SITESEO_PRO_VERSION')){
echo'<a href="admin.php?page=siteseo-pro-page">'.esc_html__('Settings', 'siteseo').'</a>';
} else{
echo'<div class="siteseo-pro-badge">Pro</div>';
}
if(class_exists('\SiteSEOPro\Settings\Util') && method_exists('\SiteSEOPro\Settings\Util', 'render_toggle')){
\SiteSEOPro\Settings\Util::render_toggle('404_monitoring', $toggle_state_redirect, $pro_nonce, true);
}
echo'</div>
</div>
<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-index-card siteseo-card-icon"></span>
<h3>'.esc_html__('Google News','siteseo').'</h3>
<p>'.esc_html__('Generate and manage a Google News sitemap to ensure your news articles get indexed quickly.','siteseo').'</p>
</div>
<div class="siteseo-card-footer">';
if(defined('SITESEO_PRO_VERSION')){
echo'<a href="admin.php?page=siteseo-pro-page">'.esc_html__('Settings', 'siteseo').'</a>';
} else{
echo'<div class="siteseo-pro-badge">Pro</div>';
}
if(class_exists('\SiteSEOPro\Settings\Util') && method_exists('\SiteSEOPro\Settings\Util', 'render_toggle')){
\SiteSEOPro\Settings\Util::render_toggle('google_news', $toggle_state_google_news, $pro_nonce, true);
}
echo'</div>
</div>
<div class="siteseo-card">
<div class="siteseo-card-body">
<span class="dashicons dashicons-format-video siteseo-card-icon"></span>
<h3>'.esc_html__('Video Sitemap','siteseo').'</h3>
<p>'.esc_html__('Create and manage a video sitemap to help search engines index your video content efficiently.','siteseo').'</p>
</div>
<div class="siteseo-card-footer">';
if(defined('SITESEO_PRO_VERSION')){
echo'<a href="admin.php?page=siteseo-pro-page">'.esc_html__('Settings', 'siteseo').'</a>';
} else{
echo'<div class="siteseo-pro-badge">Pro</div>';
}
if(class_exists('\SiteSEOPro\Settings\Util') && method_exists('\SiteSEOPro\Settings\Util', 'render_toggle')){
\SiteSEOPro\Settings\Util::render_toggle('video_sitemap', $toggle_state_video_sitemap, $pro_nonce, true);
}
echo'</div>
</div>
<div class="siteseo-card">
'.((time() < strtotime('30 November 2025')) ? '<span class="siteseo-feature-new-badge">New</span>' : '') .'
<div class="siteseo-card-body">
<span class="dashicons dashicons-media-text siteseo-card-icon"></span>
<h3>'.esc_html__('LLMs txt', 'siteseo').'</h3>
<p>'.esc_html__('Generate an llms.txt file with a single click to help AI crawlers better understand, index, and represent your business accurately.', 'siteseo').'</p>
</div>
<div class="siteseo-card-footer">';
if(defined('SITESEO_PRO_VERSION')){
echo'<a href="admin.php?page=siteseo-pro-page">'.esc_html__('Settings', 'siteseo').'</a>';
} else{
echo'<div class="siteseo-pro-badge">Pro</div>';
}
if(class_exists('\SiteSEOPro\Settings\Util') && method_exists('\SiteSEOPro\Settings\Util', 'render_toggle')){
\SiteSEOPro\Settings\Util::render_toggle('llm_txt', $toggle_state_llm_txt, $pro_nonce, true);
}
echo'</div>
</div>';
echo'</div></section>';
if(!defined('SITEPAD')){
echo'<section class="siteseo-dashboard-extras">';
if(defined('SITESEO_PRO_VERSION') && defined('SITESEO_PRO_AI_BUY')){
do_action('siteseo_pro_show_ai_tokens_sidebar');
}
echo '<div class="siteseo-need-help">
<p>Quick Access</p>
<div class="siteseo-quick-links">
<div class="siteseo-quick-access-item">
<span class="dashicons dashicons-format-status"></span>
<a href="https://softaculous.deskuss.com/open.php?topicId=22" target="_blank">Support</a>
</div>
<div class="siteseo-quick-access-item">
<span class="dashicons dashicons-media-document"></span>
<a href="https://siteseo.io/docs/" target="_blank">Documentation</a>
</div>
<div class="siteseo-quick-access-item">
<span class="dashicons dashicons-feedback"></span>
<a href="https://softaculous.deskuss.com/open.php?topicId=22" target="_blank">Feedback</a>
</div>
<div class="siteseo-quick-access-item">
<span class="dashicons dashicons-star-filled" style="color:#FFD700;"></span><a href="https://wordpress.org/support/plugin/siteseo/reviews/?rate=5#new-post" target="_blank">Rate Us</a>
</div>
</div>
</div>
<div class="siteseo-admin-softaculous-branding">SiteSEO - A Softaculous Product</div>';
if(!defined('SITEPAD') && !defined('SITESEO_PRO_VERSION')){
self::pro_upsell();
}
echo '</section>';
}
echo '</div></div></div>';
}
static function pro_upsell(){
$features = [
'Search Statistics',
'Advanced Sitemaps',
'Redirection Management',
'AI-Generations Titles & Descriptions',
'LLMs.txt Support',
'and Moreā¦',
];
echo '<div class="siteseo-promo-modern-card">
<div class="siteseo-promo-header-group">
<h3 class="siteseo-promo-title">SiteSEO</h3>
<span class="siteseo-promo-badge-pro">Pro</span>
</div>
<p class="siteseo-promo-desc">'.esc_html__('Unlock advanced performance features.', 'siteseo').'</p>
<ul class="siteseo-promo-feature-list">';
foreach($features as $feature){
echo '<li class="siteseo-promo-feature-item">
<div class="siteseo-promo-check-circle">
<div class="siteseo-promo-check-icon"></div>
</div>
'.esc_html($feature).'
</li>';
}
echo '</ul>
<a href="https://siteseo.io/pricing/?utm_source=plugin_settings" class="siteseo-promo-btn-main" target="_blank">
<span class="siteseo-promo-btn-text">'.esc_html__('Upgrade to Pro', 'siteseo').'</span>
<span class="siteseo-promo-arrow">→</span>
</a>
</div>';
}
}