Dateien nach „bavarian-rank-engine/includes/Admin/views“ hochladen
This commit is contained in:
parent
438603951e
commit
3dc559ed06
5 changed files with 575 additions and 0 deletions
77
bavarian-rank-engine/includes/Admin/views/bulk.php
Normal file
77
bavarian-rank-engine/includes/Admin/views/bulk.php
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;} ?>
|
||||||
|
<div class="wrap bre-settings">
|
||||||
|
<h1><?php esc_html_e( 'Bulk Generator', 'bavarian-rank-engine' ); ?></h1>
|
||||||
|
|
||||||
|
<div id="bre-lock-warning" style="display:none;background:#fcf8e3;border:1px solid #faebcc;padding:10px 15px;margin-bottom:15px;border-radius:3px;color:#8a6d3b;"></div>
|
||||||
|
|
||||||
|
<p><?php esc_html_e( 'Generates meta descriptions for posts without an existing meta description.', 'bavarian-rank-engine' ); ?></p>
|
||||||
|
|
||||||
|
<div id="bre-bulk-stats" style="background:#fff;padding:15px;border:1px solid #ddd;margin-bottom:20px;">
|
||||||
|
<em><?php esc_html_e( 'Loading statistics…', 'bavarian-rank-engine' ); ?></em>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table class="form-table">
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Active Provider', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<select id="bre-bulk-provider">
|
||||||
|
<?php foreach ( $providers as $id => $provider ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
|
||||||
|
<option value="<?php echo esc_attr( $id ); ?>"
|
||||||
|
<?php selected( $settings['provider'], $id ); ?>>
|
||||||
|
<?php echo esc_html( $provider->getName() ); ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Model:', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<select id="bre-bulk-model">
|
||||||
|
<?php
|
||||||
|
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
|
||||||
|
$active_provider = $registry->get( $settings['provider'] );
|
||||||
|
if ( $active_provider ) :
|
||||||
|
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
|
||||||
|
$saved_model = $settings['models'][ $settings['provider'] ] ?? array_key_first( $active_provider->getModels() );
|
||||||
|
foreach ( $active_provider->getModels() as $mid => $mlabel ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
|
||||||
|
?>
|
||||||
|
<option value="<?php echo esc_attr( $mid ); ?>"
|
||||||
|
<?php selected( $saved_model, $mid ); ?>>
|
||||||
|
<?php echo esc_html( $mlabel ); ?>
|
||||||
|
</option>
|
||||||
|
<?php
|
||||||
|
endforeach;
|
||||||
|
endif;
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Max. posts this run', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<input type="number" id="bre-bulk-limit" value="20" min="1" max="500">
|
||||||
|
<p class="description" id="bre-cost-estimate"></p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<button id="bre-bulk-start" class="button button-primary"><?php esc_html_e( 'Start Bulk Run', 'bavarian-rank-engine' ); ?></button>
|
||||||
|
<button id="bre-bulk-stop" class="button" style="display:none;"><?php esc_html_e( 'Cancel', 'bavarian-rank-engine' ); ?></button>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div id="bre-progress-wrap" style="display:none;margin:15px 0;">
|
||||||
|
<div style="background:#ddd;border-radius:3px;height:20px;width:100%;">
|
||||||
|
<div id="bre-progress-bar"
|
||||||
|
style="background:#0073aa;height:20px;border-radius:3px;width:0;transition:width .3s;"></div>
|
||||||
|
</div>
|
||||||
|
<p id="bre-progress-text"><?php esc_html_e( '0 / 0 processed', 'bavarian-rank-engine' ); ?></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="bre-bulk-log"
|
||||||
|
style="background:#1e1e1e;color:#d4d4d4;padding:15px;font-family:monospace;font-size:12px;max-height:400px;overflow-y:auto;display:none;"></div>
|
||||||
|
|
||||||
|
<div id="bre-failed-summary" style="display:none;background:#fdf2f2;border:1px solid #f5c6cb;padding:10px 15px;margin-top:15px;border-radius:3px;font-size:13px;"></div>
|
||||||
|
</div>
|
||||||
137
bavarian-rank-engine/includes/Admin/views/dashboard.php
Normal file
137
bavarian-rank-engine/includes/Admin/views/dashboard.php
Normal file
|
|
@ -0,0 +1,137 @@
|
||||||
|
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;} ?>
|
||||||
|
<div class="wrap bre-settings">
|
||||||
|
<h1><?php esc_html_e( 'Bavarian Rank Engine — Dashboard', 'bavarian-rank-engine' ); ?></h1>
|
||||||
|
|
||||||
|
<div class="bre-dashboard-grid" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:20px;margin-top:20px;">
|
||||||
|
|
||||||
|
<div class="postbox">
|
||||||
|
<div class="postbox-header"><h2><?php esc_html_e( 'Meta Coverage', 'bavarian-rank-engine' ); ?></h2></div>
|
||||||
|
<div class="inside">
|
||||||
|
<?php if ( empty( $meta_stats ) ) : ?>
|
||||||
|
<p><?php esc_html_e( 'No post types configured.', 'bavarian-rank-engine' ); ?></p>
|
||||||
|
<?php else : ?>
|
||||||
|
<table class="widefat striped">
|
||||||
|
<thead><tr>
|
||||||
|
<th><?php esc_html_e( 'Post Type', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<th><?php esc_html_e( 'Published', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<th><?php esc_html_e( 'With Meta', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<th><?php esc_html_e( 'Coverage', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
</tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ( $meta_stats as $pt => $stat ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
|
||||||
|
<tr>
|
||||||
|
<td><strong><?php echo esc_html( $pt ); ?></strong></td>
|
||||||
|
<td><?php echo esc_html( $stat['total'] ); ?></td>
|
||||||
|
<td><?php echo esc_html( $stat['with_meta'] ); ?></td>
|
||||||
|
<td><?php echo esc_html( $stat['pct'] ); ?>%</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="postbox">
|
||||||
|
<div class="postbox-header"><h2><?php esc_html_e( 'Quick Links', 'bavarian-rank-engine' ); ?></h2></div>
|
||||||
|
<div class="inside">
|
||||||
|
<ul style="margin:0;padding:0 0 0 20px;">
|
||||||
|
<li><a href="<?php echo esc_url( admin_url( 'admin.php?page=bre-provider' ) ); ?>"><?php esc_html_e( 'AI Provider Settings', 'bavarian-rank-engine' ); ?></a></li>
|
||||||
|
<li><a href="<?php echo esc_url( admin_url( 'admin.php?page=bre-meta' ) ); ?>"><?php esc_html_e( 'Meta Generator Settings', 'bavarian-rank-engine' ); ?></a></li>
|
||||||
|
<li><a href="<?php echo esc_url( admin_url( 'admin.php?page=bre-llms' ) ); ?>">llms.txt</a></li>
|
||||||
|
<li><a href="<?php echo esc_url( admin_url( 'admin.php?page=bre-bulk' ) ); ?>"><?php esc_html_e( 'Bulk Generator', 'bavarian-rank-engine' ); ?></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="postbox">
|
||||||
|
<div class="postbox-header"><h2><?php esc_html_e( 'Status', 'bavarian-rank-engine' ); ?></h2></div>
|
||||||
|
<div class="inside">
|
||||||
|
<p><strong><?php esc_html_e( 'Version:', 'bavarian-rank-engine' ); ?></strong> <?php echo esc_html( BRE_VERSION ); ?></p>
|
||||||
|
<p><strong><?php esc_html_e( 'Active Provider:', 'bavarian-rank-engine' ); ?></strong> <?php echo esc_html( $provider ); ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="postbox">
|
||||||
|
<div class="postbox-header"><h2><?php esc_html_e( 'Interne Link-Analyse', 'bavarian-rank-engine' ); ?></h2></div>
|
||||||
|
<div class="inside" id="bre-link-analysis-content">
|
||||||
|
<em><?php esc_html_e( 'Wird geladen…', 'bavarian-rank-engine' ); ?></em>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="postbox">
|
||||||
|
<div class="postbox-header"><h2><?php esc_html_e( 'AI Crawler — letzte 30 Tage', 'bavarian-rank-engine' ); ?></h2></div>
|
||||||
|
<div class="inside">
|
||||||
|
<?php $crawlers = \BavarianRankEngine\Features\CrawlerLog::get_recent_summary( 30 ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
|
||||||
|
<?php if ( empty( $crawlers ) ) : ?>
|
||||||
|
<p><?php esc_html_e( 'Noch keine AI-Crawls aufgezeichnet.', 'bavarian-rank-engine' ); ?></p>
|
||||||
|
<?php else : ?>
|
||||||
|
<table class="widefat striped">
|
||||||
|
<thead><tr>
|
||||||
|
<th><?php esc_html_e( 'Bot', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<th><?php esc_html_e( 'Besuche', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<th><?php esc_html_e( 'Zuletzt', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
</tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ( $crawlers as $row ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
|
||||||
|
<tr>
|
||||||
|
<td><code><?php echo esc_html( $row['bot_name'] ); ?></code></td>
|
||||||
|
<td><?php echo esc_html( $row['visits'] ); ?></td>
|
||||||
|
<td><?php echo esc_html( $row['last_seen'] ); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
jQuery(function($){
|
||||||
|
$.post(ajaxurl, {
|
||||||
|
action: 'bre_link_analysis',
|
||||||
|
nonce: '<?php echo esc_js( wp_create_nonce( 'bre_admin' ) ); ?>'
|
||||||
|
}).done(function(res){
|
||||||
|
if(!res.success){
|
||||||
|
$('#bre-link-analysis-content').text('Analysefehler.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var d=res.data, h='';
|
||||||
|
h+='<p><strong>Posts ohne interne Links ('+d.no_internal_links.length+')</strong></p>';
|
||||||
|
if(d.no_internal_links.length){
|
||||||
|
h+='<ul style="margin:0 0 10px 20px;">';
|
||||||
|
$.each(d.no_internal_links.slice(0,10),function(i,p){
|
||||||
|
h+='<li>'+$('<span>').text(p.title).html()+'</li>';
|
||||||
|
});
|
||||||
|
if(d.no_internal_links.length>10) h+='<li>…</li>';
|
||||||
|
h+='</ul>';
|
||||||
|
} else { h+='<p>Alle Posts haben interne Links.</p>'; }
|
||||||
|
|
||||||
|
h+='<p><strong>Posts mit vielen externen Links (≥'+d.threshold+')</strong></p>';
|
||||||
|
if(d.too_many_external.length){
|
||||||
|
h+='<ul style="margin:0 0 10px 20px;">';
|
||||||
|
$.each(d.too_many_external.slice(0,5),function(i,p){
|
||||||
|
h+='<li>'+$('<span>').text(p.title).html()+' ('+p.count+')</li>';
|
||||||
|
});
|
||||||
|
h+='</ul>';
|
||||||
|
} else { h+='<p>Keine auffälligen Posts.</p>'; }
|
||||||
|
|
||||||
|
h+='<p><strong>Pillar Pages (Top 5)</strong></p>';
|
||||||
|
if(d.pillar_pages.length){
|
||||||
|
h+='<ul style="margin:0 0 10px 20px;">';
|
||||||
|
$.each(d.pillar_pages,function(i,p){
|
||||||
|
h+='<li><a href="'+$('<span>').text(p.url).html()+'" target="_blank">'+$('<span>').text(p.url).html()+'</a> ('+p.count+'x)</li>';
|
||||||
|
});
|
||||||
|
h+='</ul>';
|
||||||
|
} else { h+='<p>Keine Daten.</p>'; }
|
||||||
|
|
||||||
|
$('#bre-link-analysis-content').html(h);
|
||||||
|
}).fail(function(){
|
||||||
|
$('#bre-link-analysis-content').text('Verbindungsfehler.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
150
bavarian-rank-engine/includes/Admin/views/llms.php
Normal file
150
bavarian-rank-engine/includes/Admin/views/llms.php
Normal file
|
|
@ -0,0 +1,150 @@
|
||||||
|
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;} ?>
|
||||||
|
<div class="wrap bre-settings">
|
||||||
|
<h1><?php esc_html_e( 'llms.txt Configuration', 'bavarian-rank-engine' ); ?></h1>
|
||||||
|
|
||||||
|
<div style="margin-bottom:20px;">
|
||||||
|
<button id="bre-llms-clear-cache" class="button">
|
||||||
|
<?php esc_html_e( 'llms.txt Cache leeren', 'bavarian-rank-engine' ); ?>
|
||||||
|
</button>
|
||||||
|
<span id="bre-cache-result" style="margin-left:10px;color:#46b450;"></span>
|
||||||
|
<script>
|
||||||
|
jQuery(document).ready(function($){
|
||||||
|
$('#bre-llms-clear-cache').on('click', function(){
|
||||||
|
$.post(ajaxurl, {
|
||||||
|
action: 'bre_llms_clear_cache',
|
||||||
|
nonce: '<?php echo esc_js( wp_create_nonce( 'bre_admin' ) ); ?>'
|
||||||
|
}).done(function(res){
|
||||||
|
$('#bre-cache-result').text(res.success ? res.data : 'Fehler');
|
||||||
|
setTimeout(function(){ $('#bre-cache-result').text(''); }, 3000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php settings_errors( 'bre_llms' ); ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?php esc_html_e( 'Your llms.txt will be served at:', 'bavarian-rank-engine' ); ?>
|
||||||
|
<a href="<?php echo esc_url( $llms_url ); ?>" target="_blank" rel="noopener">
|
||||||
|
<?php echo esc_html( $llms_url ); ?>
|
||||||
|
</a>
|
||||||
|
<?php if ( $settings['enabled'] ) : ?>
|
||||||
|
<span style="color:green;margin-left:8px;">● <?php esc_html_e( 'Active', 'bavarian-rank-engine' ); ?></span>
|
||||||
|
<?php else : ?>
|
||||||
|
<span style="color:#999;margin-left:8px;">● <?php esc_html_e( 'Inactive', 'bavarian-rank-engine' ); ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<form method="post" action="options.php">
|
||||||
|
<?php settings_fields( 'bre_llms' ); ?>
|
||||||
|
|
||||||
|
<table class="form-table">
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Enable llms.txt', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="bre_llms_settings[enabled]" value="1"
|
||||||
|
<?php checked( $settings['enabled'], true ); ?>>
|
||||||
|
<?php esc_html_e( 'Serve llms.txt at', 'bavarian-rank-engine' ); ?>
|
||||||
|
<code>/llms.txt</code>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Title', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<input type="text"
|
||||||
|
name="bre_llms_settings[title]"
|
||||||
|
value="<?php echo esc_attr( $settings['title'] ); ?>"
|
||||||
|
class="regular-text"
|
||||||
|
placeholder="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>">
|
||||||
|
<p class="description"><?php esc_html_e( 'Appears as the # heading in llms.txt', 'bavarian-rank-engine' ); ?></p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Description (before links)', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<textarea name="bre_llms_settings[description_before]"
|
||||||
|
rows="4" class="large-text"><?php echo esc_textarea( $settings['description_before'] ); ?></textarea>
|
||||||
|
<p class="description"><?php esc_html_e( 'Text shown after the title, before featured links.', 'bavarian-rank-engine' ); ?></p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Featured Links', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<textarea name="bre_llms_settings[custom_links]"
|
||||||
|
rows="5" class="large-text"><?php echo esc_textarea( $settings['custom_links'] ); ?></textarea>
|
||||||
|
<p class="description">
|
||||||
|
<?php esc_html_e( 'Important links to highlight for AI models. One per line.', 'bavarian-rank-engine' ); ?>
|
||||||
|
<?php esc_html_e( 'Markdown format recommended:', 'bavarian-rank-engine' ); ?>
|
||||||
|
<code>- [Link Name](https://url.com)</code>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Post Types', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<?php foreach ( $post_types as $pt_slug => $pt_obj ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
|
||||||
|
<label style="margin-right:15px;">
|
||||||
|
<input type="checkbox"
|
||||||
|
name="bre_llms_settings[post_types][]"
|
||||||
|
value="<?php echo esc_attr( $pt_slug ); ?>"
|
||||||
|
<?php checked( in_array( $pt_slug, $settings['post_types'], true ), true ); ?>>
|
||||||
|
<?php echo esc_html( $pt_obj->labels->singular_name ); ?>
|
||||||
|
</label>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<p class="description"><?php esc_html_e( 'Which post types to include in the content list.', 'bavarian-rank-engine' ); ?></p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Max. Links pro Seite', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<input type="number" name="bre_llms_settings[max_links]"
|
||||||
|
value="<?php echo esc_attr( $settings['max_links'] ?? 500 ); ?>"
|
||||||
|
min="50" max="5000" style="width:80px;">
|
||||||
|
<p class="description">
|
||||||
|
<?php esc_html_e( 'Bei mehr Posts werden automatisch llms-2.txt, llms-3.txt etc. erstellt und verlinkt.', 'bavarian-rank-engine' ); ?>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Description (after content)', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<textarea name="bre_llms_settings[description_after]"
|
||||||
|
rows="4" class="large-text"><?php echo esc_textarea( $settings['description_after'] ); ?></textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Footer Description', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<textarea name="bre_llms_settings[description_footer]"
|
||||||
|
rows="4" class="large-text"><?php echo esc_textarea( $settings['description_footer'] ); ?></textarea>
|
||||||
|
<p class="description"><?php esc_html_e( 'Appears at the end of llms.txt after a --- separator.', 'bavarian-rank-engine' ); ?></p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php submit_button( __( 'Save llms.txt Settings', 'bavarian-rank-engine' ) ); ?>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<h2><?php esc_html_e( 'Preview', 'bavarian-rank-engine' ); ?></h2>
|
||||||
|
<p class="description">
|
||||||
|
<?php esc_html_e( 'After saving, visit your llms.txt to verify:', 'bavarian-rank-engine' ); ?>
|
||||||
|
<a href="<?php echo esc_url( $llms_url ); ?>" target="_blank" rel="noopener">
|
||||||
|
<?php echo esc_html( $llms_url ); ?>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p class="description" style="color:#d63638;">
|
||||||
|
<?php esc_html_e( 'Note: If the URL shows a 404, go to Settings → Permalinks and click Save to flush rewrite rules.', 'bavarian-rank-engine' ); ?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
110
bavarian-rank-engine/includes/Admin/views/meta.php
Normal file
110
bavarian-rank-engine/includes/Admin/views/meta.php
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;} ?>
|
||||||
|
<div class="wrap bre-settings">
|
||||||
|
<h1><?php esc_html_e( 'Meta Generator', 'bavarian-rank-engine' ); ?></h1>
|
||||||
|
|
||||||
|
<?php settings_errors( 'bre_meta' ); ?>
|
||||||
|
|
||||||
|
<form method="post" action="options.php">
|
||||||
|
<?php settings_fields( 'bre_meta' ); ?>
|
||||||
|
|
||||||
|
<h2><?php esc_html_e( 'Meta Generator', 'bavarian-rank-engine' ); ?></h2>
|
||||||
|
<table class="form-table">
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Auto Mode', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox"
|
||||||
|
name="bre_meta_settings[meta_auto_enabled]"
|
||||||
|
value="1"
|
||||||
|
<?php checked( $settings['meta_auto_enabled'], true ); ?>>
|
||||||
|
<?php esc_html_e( 'Automatically generate meta description on publish', 'bavarian-rank-engine' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Post Types', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<?php foreach ( $post_types as $pt_slug => $pt_obj ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
|
||||||
|
<label style="margin-right:15px;">
|
||||||
|
<input type="checkbox"
|
||||||
|
name="bre_meta_settings[meta_post_types][]"
|
||||||
|
value="<?php echo esc_attr( $pt_slug ); ?>"
|
||||||
|
<?php checked( in_array( $pt_slug, $settings['meta_post_types'], true ), true ); ?>>
|
||||||
|
<?php echo esc_html( $pt_obj->labels->singular_name ); ?>
|
||||||
|
</label>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Token Mode', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="bre_meta_settings[token_mode]" value="full"
|
||||||
|
<?php checked( $settings['token_mode'], 'full' ); ?>>
|
||||||
|
<?php esc_html_e( 'Send full article', 'bavarian-rank-engine' ); ?>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="bre_meta_settings[token_mode]" value="limit"
|
||||||
|
<?php checked( $settings['token_mode'], 'limit' ); ?>>
|
||||||
|
<?php esc_html_e( 'Limit to', 'bavarian-rank-engine' ); ?>
|
||||||
|
<input type="number"
|
||||||
|
name="bre_meta_settings[token_limit]"
|
||||||
|
value="<?php echo esc_attr( $settings['token_limit'] ); ?>"
|
||||||
|
min="100" max="8000" style="width:80px;">
|
||||||
|
<?php esc_html_e( 'tokens', 'bavarian-rank-engine' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Prompt', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<textarea name="bre_meta_settings[prompt]"
|
||||||
|
rows="8"
|
||||||
|
class="large-text code"><?php echo esc_textarea( $settings['prompt'] ); ?></textarea>
|
||||||
|
<p class="description">
|
||||||
|
<?php esc_html_e( 'Variables:', 'bavarian-rank-engine' ); ?>
|
||||||
|
<code>{title}</code>, <code>{content}</code>, <code>{excerpt}</code>, <code>{language}</code><br>
|
||||||
|
<button type="button" class="button" id="bre-reset-prompt"><?php esc_html_e( 'Reset prompt', 'bavarian-rank-engine' ); ?></button>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h2><?php esc_html_e( 'Schema.org Enhancer (GEO)', 'bavarian-rank-engine' ); ?></h2>
|
||||||
|
<table class="form-table">
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Enabled Schema Types', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<?php foreach ( $schema_labels as $type => $label ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
|
||||||
|
<label style="display:block;margin-bottom:8px;">
|
||||||
|
<input type="checkbox"
|
||||||
|
name="bre_meta_settings[schema_enabled][]"
|
||||||
|
value="<?php echo esc_attr( $type ); ?>"
|
||||||
|
<?php checked( in_array( $type, $settings['schema_enabled'], true ), true ); ?>>
|
||||||
|
<?php echo esc_html( $label ); ?>
|
||||||
|
</label>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Organization sameAs URLs', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<p class="description"><?php esc_html_e( 'One URL per line (Twitter, LinkedIn, GitHub, Facebook…)', 'bavarian-rank-engine' ); ?></p>
|
||||||
|
<textarea name="bre_meta_settings[schema_same_as][organization]"
|
||||||
|
rows="5"
|
||||||
|
class="large-text"><?php echo esc_textarea( implode( "\n", $settings['schema_same_as']['organization'] ?? array() ) ); ?></textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php submit_button( __( 'Save Settings', 'bavarian-rank-engine' ) ); ?>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<p style="color:#999;font-size:12px;">
|
||||||
|
Bavarian Rank Engine <?php echo esc_html( BRE_VERSION ); ?> —
|
||||||
|
<?php esc_html_e( 'developed with', 'bavarian-rank-engine' ); ?> ♥ <a href="https://donau2space.de" target="_blank" rel="noopener">Donau2Space.de</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
101
bavarian-rank-engine/includes/Admin/views/provider.php
Normal file
101
bavarian-rank-engine/includes/Admin/views/provider.php
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;} ?>
|
||||||
|
<div class="wrap bre-settings">
|
||||||
|
<h1><?php esc_html_e( 'AI Provider', 'bavarian-rank-engine' ); ?></h1>
|
||||||
|
|
||||||
|
<?php settings_errors( 'bre_provider' ); ?>
|
||||||
|
|
||||||
|
<form method="post" action="options.php">
|
||||||
|
<?php settings_fields( 'bre_provider' ); ?>
|
||||||
|
|
||||||
|
<h2><?php esc_html_e( 'AI Provider', 'bavarian-rank-engine' ); ?></h2>
|
||||||
|
<table class="form-table">
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php esc_html_e( 'Active Provider', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<select name="bre_settings[provider]" id="bre-provider">
|
||||||
|
<?php foreach ( $providers as $id => $provider ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
|
||||||
|
<option value="<?php echo esc_attr( $id ); ?>"
|
||||||
|
<?php selected( $settings['provider'], $id ); ?>>
|
||||||
|
<?php echo esc_html( $provider->getName() ); ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php foreach ( $providers as $id => $provider ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
|
||||||
|
<tr class="bre-provider-row" data-provider="<?php echo esc_attr( $id ); ?>">
|
||||||
|
<th scope="row"><?php echo esc_html( $provider->getName() ); ?> <?php esc_html_e( 'API Key', 'bavarian-rank-engine' ); ?></th>
|
||||||
|
<td>
|
||||||
|
<?php if ( ! empty( $masked_keys[ $id ] ) ) : ?>
|
||||||
|
<span class="bre-key-saved">
|
||||||
|
<?php esc_html_e( 'Saved:', 'bavarian-rank-engine' ); ?> <code><?php echo esc_html( $masked_keys[ $id ] ); ?></code>
|
||||||
|
</span><br>
|
||||||
|
<?php endif; ?>
|
||||||
|
<input type="password"
|
||||||
|
name="bre_settings[api_keys][<?php echo esc_attr( $id ); ?>]"
|
||||||
|
value=""
|
||||||
|
placeholder="<?php echo ! empty( $masked_keys[ $id ] ) ? esc_attr__( 'Enter new key to overwrite', 'bavarian-rank-engine' ) : esc_attr__( 'Enter API key', 'bavarian-rank-engine' ); ?>"
|
||||||
|
class="regular-text"
|
||||||
|
autocomplete="new-password">
|
||||||
|
<button type="button" class="button bre-test-btn" data-provider="<?php echo esc_attr( $id ); ?>">
|
||||||
|
<?php esc_html_e( 'Test connection', 'bavarian-rank-engine' ); ?>
|
||||||
|
</button>
|
||||||
|
<span class="bre-test-result" id="test-result-<?php echo esc_attr( $id ); ?>"></span>
|
||||||
|
<br><br>
|
||||||
|
<label><?php esc_html_e( 'Model:', 'bavarian-rank-engine' ); ?></label>
|
||||||
|
<select name="bre_settings[models][<?php echo esc_attr( $id ); ?>]">
|
||||||
|
<?php
|
||||||
|
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
|
||||||
|
$saved_model = $settings['models'][ $id ] ?? array_key_first( $provider->getModels() );
|
||||||
|
foreach ( $provider->getModels() as $model_id => $model_label ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
|
||||||
|
?>
|
||||||
|
<option value="<?php echo esc_attr( $model_id ); ?>"
|
||||||
|
<?php selected( $saved_model, $model_id ); ?>>
|
||||||
|
<?php echo esc_html( $model_label ); ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
<?php
|
||||||
|
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
|
||||||
|
$pricing_url = $pricing_urls[ $id ] ?? '';
|
||||||
|
if ( $pricing_url ) :
|
||||||
|
?>
|
||||||
|
<p style="margin-top:8px;">
|
||||||
|
<a href="<?php echo esc_url( $pricing_url ); ?>" target="_blank" rel="noopener noreferrer">
|
||||||
|
<?php esc_html_e( 'Aktuelle Preise ansehen →', 'bavarian-rank-engine' ); ?>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<p style="margin-top:12px;"><strong><?php esc_html_e( 'Kosten pro 1 Million Token (für Kostenübersicht im Bulk):', 'bavarian-rank-engine' ); ?></strong></p>
|
||||||
|
<?php
|
||||||
|
foreach ( $provider->getModels() as $model_id => $model_label ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
|
||||||
|
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
|
||||||
|
$saved_costs = $settings['costs'][ $id ][ $model_id ] ?? array();
|
||||||
|
?>
|
||||||
|
<div style="margin-bottom:6px;display:flex;align-items:center;gap:12px;">
|
||||||
|
<label style="min-width:180px;font-size:12px;"><?php echo esc_html( $model_label ); ?>:</label>
|
||||||
|
<span>Input $<input type="number" step="0.0001" min="0"
|
||||||
|
name="bre_settings[costs][<?php echo esc_attr( $id ); ?>][<?php echo esc_attr( $model_id ); ?>][input]"
|
||||||
|
value="<?php echo esc_attr( $saved_costs['input'] ?? '' ); ?>"
|
||||||
|
placeholder="z.B. 0.15" style="width:75px;"> / 1M</span>
|
||||||
|
<span>Output $<input type="number" step="0.0001" min="0"
|
||||||
|
name="bre_settings[costs][<?php echo esc_attr( $id ); ?>][<?php echo esc_attr( $model_id ); ?>][output]"
|
||||||
|
value="<?php echo esc_attr( $saved_costs['output'] ?? '' ); ?>"
|
||||||
|
placeholder="z.B. 0.60" style="width:75px;"> / 1M</span>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php submit_button( __( 'Save Settings', 'bavarian-rank-engine' ) ); ?>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<p style="color:#999;font-size:12px;">
|
||||||
|
Bavarian Rank Engine <?php echo esc_html( BRE_VERSION ); ?> —
|
||||||
|
<?php esc_html_e( 'developed with', 'bavarian-rank-engine' ); ?> ♥ <a href="https://donau2space.de" target="_blank" rel="noopener">Donau2Space.de</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
Loading…
Reference in a new issue