/
home
/
altere25
/
.trash
/
wp-to-sanity-companion-1.2
/
/home/altere25/.trash/wp-to-sanity-companion-1.2
mkdir
upload
Name
Size
Mode
Actions
assets/
-
0755
rm
includes/
-
0755
rm
templates/
-
0755
rm
assets\css\admin.css
7611
0644
edit
dl
rm
assets\js\admin.js
8534
0644
edit
dl
rm
assets\js\claude-connect.js
6502
0644
edit
dl
rm
includes\class-ad-admin.php
26374
0644
edit
dl
rm
includes\class-ad-ai-client.php
8153
0644
edit
dl
rm
includes\class-ad-auth.php
9189
0644
edit
dl
rm
includes\class-ad-cli.php
8669
0644
edit
dl
rm
includes\class-ad-extractor.php
12210
0644
edit
dl
rm
includes\class-ad-mcp.php
6429
0644
edit
dl
rm
includes\class-ad-plugin-core.php
7947
0644
edit
dl
rm
includes\class-ad-progress.php
8022
0644
edit
dl
rm
includes\class-ad-rest.php
31008
0644
edit
dl
rm
includes\class-ad-uninstall.php
1924
0644
edit
dl
rm
includes\class-ad-webhook.php
14854
0644
edit
dl
rm
templates\admin\claude-connect.php
5152
0644
edit
dl
rm
templates\admin\dashboard.php
10457
0644
edit
dl
rm
templates\admin\export.php
16570
0644
edit
dl
rm
templates\admin\log.php
10849
0644
edit
dl
rm
templates\admin\onboarding-v2.php
3827
0644
edit
dl
rm
templates\admin\onboarding.php
10714
0644
edit
dl
rm
templates\admin\progress.php
2443
0644
edit
dl
rm
templates\admin\schema-preview.php
5213
0644
edit
dl
rm
uninstall.php
365
0644
edit
dl
rm
wp-to-sanity-companion.php
4269
0644
edit
dl
rm
Edit:
/home/altere25/.trash/wp-to-sanity-companion-1.2/templates\admin\export.php
(16570B)
<?php /** * Export Template * * @package WPtoSanity */ if (!defined('ABSPATH')) { exit; } $plugin = WP_to_Sanity_Plugin::get_instance(); $settings = $plugin->settings(); $post_types = $settings['post_types'] ?? ['post', 'page']; // Get counts for each post type $content_stats = []; foreach ($post_types as $post_type) { $counts = wp_count_posts($post_type); $content_stats[$post_type] = $counts; } ?> <div class="wrap wp-to-sanity-export"> <h1><?php echo esc_html(get_admin_page_title()); ?></h1> <?php if (empty($settings['webhook_url'])) : ?> <div class="notice notice-error"> <p> <?php esc_html_e('Please configure your webhook URL in the', 'wp-to-sanity'); ?> <a href="<?php echo admin_url('admin.php?page=wp-to-sanity-settings'); ?>"> <?php esc_html_e('settings', 'wp-to-sanity'); ?> </a> <?php esc_html_e('before exporting.', 'wp-to-sanity'); ?> </p> </div> <?php endif; ?> <div class="wp-to-sanity-export-sections"> <!-- Quick Export --> <div class="export-section"> <h2><?php esc_html_e('Quick Export', 'wp-to-sanity'); ?></h2> <p class="description"> <?php esc_html_e('Export all content of a specific type.', 'wp-to-sanity'); ?> </p> <div class="export-options"> <?php foreach ($post_types as $post_type) : $post_type_object = get_post_type_object($post_type); $total = array_sum((array) $content_stats[$post_type]); ?> <div class="export-option"> <h3><?php echo esc_html($post_type_object->label); ?></h3> <p class="count"><?php echo esc_html($total); ?> <?php esc_html_e('items', 'wp-to-sanity'); ?></p> <button class="button button-primary" onclick="wpToSanityExportAll('<?php echo esc_attr($post_type); ?>')"> <?php printf( esc_html__('Export All %s', 'wp-to-sanity'), $post_type_object->label ); ?> </button> <a href="<?php echo admin_url('edit.php?post_type=' . $post_type); ?>" class="button"> <?php esc_html_e('View All', 'wp-to-sanity'); ?> </a> </div> <?php endforeach; ?> </div> </div> <!-- Bulk Export --> <div class="export-section"> <h2><?php esc_html_e('Bulk Export', 'wp-to-sanity'); ?></h2> <p class="description"> <?php esc_html_e('Select specific items to export.', 'wp-to-sanity'); ?> </p> <?php foreach ($post_types as $post_type) : $post_type_object = get_post_type_object($post_type); $args = [ 'post_type' => $post_type, 'posts_per_page' => 100, 'post_status' => ['publish', 'draft', 'pending', 'future'], 'orderby' => 'modified', 'order' => 'DESC', ]; $query = new WP_Query($args); ?> <div class="bulk-export-section"> <h3> <input type="checkbox" class="wp-to-sanity-select-all" data-post-type="<?php echo esc_attr($post_type); ?>"> <?php echo esc_html($post_type_object->label); ?> </h3> <?php if ($query->have_posts()) : ?> <table class="wp-list-table widefat fixed striped"> <thead> <tr> <th class="cb-column"> </th> <th><?php esc_html_e('Title', 'wp-to-sanity'); ?></th> <th><?php esc_html_e('Status', 'wp-to-sanity'); ?></th> <th><?php esc_html_e('Modified', 'wp-to-sanity'); ?></th> <th><?php esc_html_e('Last Sync', 'wp-to-sanity'); ?></th> </tr> </thead> <tbody> <?php while ($query->have_posts()) : $query->the_post(); global $wpdb; $log_table = $wpdb->prefix . 'ad_migration_log'; $last_sync = $wpdb->get_row($wpdb->prepare( "SELECT * FROM {$log_table} WHERE post_id = %d ORDER BY created_at DESC LIMIT 1", get_the_ID() ), ARRAY_A); ?> <tr> <th class="cb-column"> <input type="checkbox" class="wp-to-sanity-item" data-post-type="<?php echo esc_attr($post_type); ?>" value="<?php echo get_the_ID(); ?>"> </th> <td> <strong><?php the_title(); ?></strong> </td> <td> <span class="status-badge status-<?php echo esc_attr(get_post_status()); ?>"> <?php echo esc_html(get_post_status_object(get_post_status())->label); ?> </span> </td> <td><?php echo get_the_modified_date(); ?> <?php echo get_the_modified_time(); ?></td> <td> <?php if ($last_sync) : ?> <span class="status-badge status-<?php echo esc_attr($last_sync['status']); ?>"> <?php echo esc_html(ucfirst($last_sync['status'])); ?> </span> <small><?php echo date_i18n(get_option('time_format'), strtotime($last_sync['created_at'])); ?></small> <?php else : ?> <span class="not-synced"><?php esc_html_e('Not synced', 'wp-to-sanity'); ?></span> <?php endif; ?> </td> </tr> <?php endwhile; wp_reset_postdata(); ?> </tbody> </table> <?php if ($query->found_posts > 100) : ?> <p class="description"> <?php printf( esc_html__('Showing 100 of %s items. Use Quick Export to export all.', 'wp-to-sanity'), number_format_i18n($query->found_posts) ); ?> </p> <?php endif; ?> <div class="bulk-actions"> <button class="button button-primary" onclick="wpToSanityExportSelected('<?php echo esc_attr($post_type); ?>')"> <?php esc_html_e('Export Selected', 'wp-to-sanity'); ?> </button> <span class="selected-count">0 <?php esc_html_e('selected', 'wp-to-sanity'); ?></span> </div> <?php else : ?> <p><?php esc_html_e('No items found.', 'wp-to-sanity'); ?></p> <?php endif; ?> </div> <?php endforeach; ?> </div> <!-- ACF Fields Export --> <?php if (function_exists('acf')) : ?> <div class="export-section"> <h2><?php esc_html_e('ACF Field Groups', 'wp-to-sanity'); ?></h2> <p class="description"> <?php esc_html_e('Export ACF field group definitions for schema generation.', 'wp-to-sanity'); ?> </p> <button class="button button-primary" onclick="wpToSanityExportACF()"> <?php esc_html_e('Export ACF Fields', 'wp-to-sanity'); ?> </button> <div id="wp-to-sanity-acf-output" class="code-output" style="display:none;"></div> </div> <?php endif; ?> <!-- Full Site Export --> <div class="export-section"> <h2><?php esc_html_e('Full Site Export', 'wp-to-sanity'); ?></h2> <p class="description"> <?php esc_html_e('Export everything at once. This may take a while for large sites.', 'wp-to-sanity'); ?> </p> <button class="button button-primary button-large" onclick="wpToSanityFullExport()"> <?php esc_html_e('🚀 Start Full Export', 'wp-to-sanity'); ?> </button> <div id="wp-to-sanity-progress" class="progress-container" style="display:none;"> <div class="progress-bar"> <div class="progress-fill" style="width: 0%;"></div> </div> <p class="progress-text"><span class="progress-percent">0</span>% - <span class="progress-current">0</span>/<span class="progress-total">0</span></p> </div> </div> </div> </div> <style> .wp-to-sanity-export-sections { margin-top: 20px; } .export-section { background: #fff; border: 1px solid #c3c4c7; border-radius: 8px; padding: 20px; margin-bottom: 20px; } .export-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; } .export-option { background: #f0f0f1; padding: 20px; border-radius: 8px; text-align: center; } .export-option .count { font-size: 1.5em; color: #2271b1; margin: 10px 0; } .bulk-export-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid #c3c4c7; } .bulk-export-section h3 { display: flex; align-items: center; gap: 10px; } .cb-column { width: 50px; } .status-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.85em; } .status-badge.publish { background: #d1fae5; color: #065f46; } .status-badge.draft { background: #fef3c7; color: #92400e; } .status-badge.pending { background: #dbeafe; color: #1e40af; } .status-badge.future { background: #e0e7ff; color: #3730a3; } .status-badge.success { background: #d1fae5; color: #065f46; } .status-badge.failed { background: #fee2e2; color: #991b1b; } .not-synced { color: #646970; font-style: italic; } .bulk-actions { margin-top: 15px; display: flex; align-items: center; gap: 15px; } .selected-count { color: #646970; } .progress-container { margin-top: 20px; } .progress-bar { height: 20px; background: #f0f0f1; border-radius: 10px; overflow: hidden; } .progress-fill { height: 100%; background: linear-gradient(90deg, #2271b1, #00a32a); transition: width 0.3s ease; } .progress-text { text-align: center; margin-top: 10px; color: #646970; } .code-output { margin-top: 15px; background: #1e1e1e; color: #d4d4d4; padding: 15px; border-radius: 4px; font-family: monospace; font-size: 12px; max-height: 400px; overflow-y: auto; white-space: pre-wrap; } </style> <script> jQuery(document).ready(function($) { // Select all for post type $('.wp-to-sanity-select-all').on('change', function() { const postType = $(this).data('post-type'); const checked = this.checked; $(`.wp-to-sanity-item[data-post-type="${postType}"]`).prop('checked', checked); updateSelectedCount(); }); // Update selected count $('.wp-to-sanity-item').on('change', updateSelectedCount); function updateSelectedCount() { const count = $('.wp-to-sanity-item:checked').length; $('.selected-count').text(count + ' selected'); } }); function wpToSanityExportAll(postType) { if (!confirm('Export all ' + postType + ' to Sanity? This may take a while.')) { return; } jQuery.ajax({ url: wpToSanity.restUrl + 'export/bulk', method: 'POST', headers: { 'X-WP-Nonce': wpToSanity.restNonce }, data: { post_type: postType, export_all: true } }) .done(function(response) { if (response.success) { alert('Export complete! ' + response.data.count + ' items exported.'); } else { alert('Export failed: ' + response.data.error); } }) .fail(function(xhr) { alert('Export failed: ' + xhr.responseText); }); } function wpToSanityExportSelected(postType) { const selected = []; jQuery(`.wp-to-sanity-item[data-post-type="${postType}"]:checked`).each(function() { selected.push(parseInt(this.value)); }); if (selected.length === 0) { alert('Please select at least one item.'); return; } if (!confirm('Export ' + selected.length + ' selected items to Sanity?')) { return; } jQuery.ajax({ url: wpToSanity.restUrl + 'export/bulk', method: 'POST', headers: { 'X-WP-Nonce': wpToSanity.restNonce }, data: { post_type: postType, post_ids: selected } }) .done(function(response) { if (response.success) { alert('Export complete! ' + response.data.count + ' items exported.'); location.reload(); } else { alert('Export failed: ' + response.data.error); } }) .fail(function(xhr) { alert('Export failed: ' + xhr.responseText); }); } function wpToSanityExportACF() { jQuery.ajax({ url: wpToSanity.restUrl + 'acf-fields', method: 'GET', headers: { 'X-WP-Nonce': wpToSanity.restNonce } }) .done(function(response) { if (response.success) { const output = document.getElementById('wp-to-sanity-acf-output'); output.style.display = 'block'; output.textContent = JSON.stringify(response.data, null, 2); } else { alert('ACF export failed: ' + response.data.error); } }) .fail(function(xhr) { alert('ACF export failed: ' + xhr.responseText); }); } function wpToSanityFullExport() { if (!confirm('Start full site export? This may take several minutes for large sites.')) { return; } const progressContainer = document.getElementById('wp-to-sanity-progress'); progressContainer.style.display = 'block'; // Start the full export process jQuery.ajax({ url: wpToSanity.restUrl + 'export/full', method: 'POST', headers: { 'X-WP-Nonce': wpToSanity.restNonce }, }) .done(function(response) { if (response.success) { alert('Full export complete!'); } else { alert('Full export failed: ' + response.data.error); } }) .fail(function(xhr) { alert('Full export failed: ' + xhr.responseText); }); } function wpToSanitySyncPost(postId) { jQuery.ajax({ url: wpToSanity.restUrl + 'export', method: 'POST', headers: { 'X-WP-Nonce': wpToSanity.restNonce }, data: { post_id: postId }, }) .done(function(response) { if (response.success) { alert('Post synced successfully!'); location.reload(); } else { alert('Sync failed: ' + response.data.error); } }) .fail(function(xhr) { alert('Sync failed: ' + xhr.responseText); }); } </script>
Save
cmd:
run