Changeset 3289054
- Timestamp:
- 05/07/2025 10:34:12 AM (11 months ago)
- Location:
- topirank-integration
- Files:
-
- 42 added
- 7 edited
-
tags/2.0.1 (added)
-
tags/2.0.1/admin (added)
-
tags/2.0.1/admin/admin-page.php (added)
-
tags/2.0.1/admin/batch-page.php (added)
-
tags/2.0.1/admin/menu.php (added)
-
tags/2.0.1/assets (added)
-
tags/2.0.1/assets/css (added)
-
tags/2.0.1/assets/css/batch-conflicts.css (added)
-
tags/2.0.1/assets/css/batch-process.css (added)
-
tags/2.0.1/assets/css/topirank-admin-style.css (added)
-
tags/2.0.1/assets/css/topirank-editor-style.css (added)
-
tags/2.0.1/assets/css/topirank-normalize.css (added)
-
tags/2.0.1/assets/css/topirank-post-admin-style.css (added)
-
tags/2.0.1/assets/js (added)
-
tags/2.0.1/assets/js/batch-conflicts.js (added)
-
tags/2.0.1/assets/js/batch-process.js (added)
-
tags/2.0.1/assets/js/topirank-admin-scripts.js (added)
-
tags/2.0.1/assets/js/topirank-normalize.js (added)
-
tags/2.0.1/includes (added)
-
tags/2.0.1/includes/api-integration.php (added)
-
tags/2.0.1/includes/batch-processing.php (added)
-
tags/2.0.1/includes/batch-processor.php (added)
-
tags/2.0.1/includes/class-topirank-integration.php (added)
-
tags/2.0.1/includes/create-template.php (added)
-
tags/2.0.1/includes/extract-and-create.php (added)
-
tags/2.0.1/includes/file-upload.php (added)
-
tags/2.0.1/includes/helpers.php (added)
-
tags/2.0.1/includes/init.php (added)
-
tags/2.0.1/includes/register-files.php (added)
-
tags/2.0.1/includes/resource-cleaner.php (added)
-
tags/2.0.1/includes/topirank-template.php (added)
-
tags/2.0.1/includes/update-content-and-seo.php (added)
-
tags/2.0.1/includes/update-functionality.php (added)
-
tags/2.0.1/includes/utils.php (added)
-
tags/2.0.1/includes/version-endpoint.php (added)
-
tags/2.0.1/languages (added)
-
tags/2.0.1/languages/topirank-integration-fr_FR.mo (added)
-
tags/2.0.1/languages/topirank-integration-fr_FR.po (added)
-
tags/2.0.1/languages/topirank-integration.pot (added)
-
tags/2.0.1/readme.txt (added)
-
tags/2.0.1/topirank-integration.php (added)
-
trunk/admin/admin-page.php (modified) (2 diffs)
-
trunk/assets/css/topirank-admin-style.css (modified) (2 diffs)
-
trunk/includes/batch-processor.php (modified) (5 diffs)
-
trunk/includes/topirank-template.php (modified) (1 diff)
-
trunk/includes/update-content-and-seo.php (modified) (1 diff)
-
trunk/includes/version-endpoint.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/topirank-integration.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
topirank-integration/trunk/admin/admin-page.php
r3286404 r3289054 109 109 </div> 110 110 <?php } ?> 111 <div class="topirank_version"> 112 <?php 113 $plugin_data = get_plugin_data(plugin_dir_path(dirname(__FILE__)) . 'topirank-integration.php'); 114 echo esc_html(sprintf('Version %s', $plugin_data['Version'])); 115 ?> 116 </div> 111 117 </div> 118 119 112 120 </div> 113 121 … … 146 154 } 147 155 148 setInterval(updateServerStatus, 5000);149 156 updateServerStatus(); 150 157 }); 151 158 </script> 152 153 <style>154 .topirank_wrap .server-status-container {155 display: flex;156 align-items: center;157 gap: 10px;158 }159 160 .topirank_wrap .server-status-indicator {161 width: 12px;162 height: 12px;163 border-radius: 50%;164 display: inline-block;165 }166 167 .topirank_wrap .server-status-indicator.ready {168 background-color: #46b450;169 }170 171 .topirank_wrap .server-status-indicator.not-ready {172 background-color: #dc3232;173 }174 175 .topirank_wrap .server-status-text {176 font-weight: 500;177 }178 179 .topirank_wrap .button:disabled,180 .topirank_wrap .topirank_solid_button:disabled,181 .topirank_wrap .topirank_outline_button:disabled {182 opacity: 0.7;183 cursor: not-allowed;184 }185 </style>186 159 <?php 187 160 } -
topirank-integration/trunk/assets/css/topirank-admin-style.css
r3220350 r3289054 61 61 } 62 62 .topirank_wrap { 63 display: flex; 64 flex-direction: column; 63 65 padding: 16px 32px; 64 66 border-radius: 12px; … … 274 276 margin-bottom: 4px; 275 277 } 278 279 .topirank_wrap .server-status-container { 280 display: flex; 281 align-items: center; 282 gap: 10px; 283 } 284 285 .topirank_wrap .server-status-indicator { 286 width: 12px; 287 height: 12px; 288 border-radius: 50%; 289 display: inline-block; 290 } 291 292 .topirank_wrap .server-status-indicator.ready { 293 background-color: #46b450; 294 } 295 296 .topirank_wrap .server-status-indicator.not-ready { 297 background-color: #dc3232; 298 } 299 300 .topirank_wrap .server-status-text { 301 font-weight: 500; 302 } 303 304 .topirank_wrap .button:disabled, 305 .topirank_wrap .topirank_solid_button:disabled, 306 .topirank_wrap .topirank_outline_button:disabled { 307 opacity: 0.7; 308 cursor: not-allowed; 309 } 310 311 .topirank_version { 312 text-align: right; 313 margin-top: auto; 314 font-size: 12px; 315 color: #666; 316 padding: 5px 10px; 317 } -
topirank-integration/trunk/includes/batch-processor.php
r3286408 r3289054 100 100 101 101 $start = $this->current_batch * $this->batch_size; 102 $end = min($start + $this->batch_size, $this->total_files);103 102 104 103 $batch_files = array_slice($this->files_to_process, $start, $this->batch_size); … … 220 219 } 221 220 222 usleep( 500000);221 usleep(100000); 223 222 } 224 223 … … 247 246 $final_messages = $batch_messages; 248 247 $final_conflicts = $this->conflicts; 248 249 do_action('topirank_after_last_batch'); 249 250 250 251 $final_progress = array( … … 469 470 } 470 471 471 usleep( 500000);472 usleep(100000); 472 473 } 473 474 … … 499 500 $final_conflicts = $this->conflicts; 500 501 502 do_action('topirank_after_last_batch'); 503 501 504 $final_progress = array( 502 505 'processed' => $final_processed, -
topirank-integration/trunk/includes/topirank-template.php
r3286439 r3289054 3 3 if (! defined('ABSPATH')) exit; 4 4 /* Template Name: Topirank Post Template */ 5 /* Template Post Type: post */5 /* Template Post Type: post, page */ 6 6 if (is_user_logged_in()) { 7 7 show_admin_bar(false); -
topirank-integration/trunk/includes/update-content-and-seo.php
r3286404 r3289054 341 341 } 342 342 } 343 344 function topirank_update_all_post_links() 345 { 346 $args = array( 347 'post_type' => 'page', 348 'post_status' => 'publish', 349 'posts_per_page' => -1, 350 ); 351 352 $query = new WP_Query($args); 353 354 if (!$query->have_posts()) { 355 return; 356 } 357 358 foreach ($query->posts as $post) { 359 $content = $post->post_content; 360 361 libxml_use_internal_errors(true); 362 $dom = new DOMDocument('1.0', 'UTF-8'); 363 $dom->preserveWhiteSpace = false; 364 $dom->formatOutput = true; 365 366 $content = '<?xml encoding="UTF-8">' . $content; 367 $dom->loadHTML($content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NOWARNING); 368 libxml_clear_errors(); 369 370 $xpath = new DOMXPath($dom); 371 $links = $xpath->query('//a[@href]'); 372 $link_slugs = []; 373 $link_elements = []; 374 375 foreach ($links as $link) { 376 $href = $link->getAttribute('href'); 377 if (preg_match('/^(?:\.\.\/)+(.+)\/index\.html$/iu', $href, $matches)) { 378 $encoded_url = $matches[1]; 379 $decoded_url = urldecode($encoded_url); 380 $slug = basename($decoded_url); 381 382 if (!empty($slug)) { 383 $link_slugs[] = $slug; 384 $link_elements[] = $link; 385 } 386 } 387 } 388 389 $unique_slugs = array_unique($link_slugs); 390 $slug_to_post = []; 391 392 393 if (!empty($unique_slugs)) { 394 foreach ($unique_slugs as $unique_slug) { 395 $post_query = new WP_Query([ 396 'name' => $unique_slug, 397 'post_type' => 'page', 398 'post_status' => 'publish', 399 'fields' => 'ids', 400 'posts_per_page' => 1, 401 ]); 402 403 $found_post_id = !empty($post_query->posts) ? $post_query->posts[0] : null; 404 if ($found_post_id) { 405 $slug_to_post[$unique_slug] = get_permalink($found_post_id); 406 } 407 wp_reset_postdata(); 408 } 409 } 410 411 412 $content_updated = false; 413 foreach ($link_elements as $index => $link) { 414 $formatted_slug = $link_slugs[$index]; 415 if (isset($slug_to_post[$formatted_slug])) { 416 $link->setAttribute('href', $slug_to_post[$formatted_slug]); 417 $content_updated = true; 418 } 419 } 420 421 if ($content_updated) { 422 $new_content = preg_replace('/<\?xml[^>]+>/', '', $dom->saveHTML()); 423 $new_content = preg_replace('/<head\b[^>]*>.*?<\/head>/is', '', $new_content); 424 425 $content_filters = $GLOBALS['wp_filter']['content_save_pre'] ?? null; 426 $content_filtered_filters = $GLOBALS['wp_filter']['content_filtered_save_pre'] ?? null; 427 $the_content_filters = $GLOBALS['wp_filter']['the_content'] ?? null; 428 $the_editor_content_filters = $GLOBALS['wp_filter']['the_editor_content'] ?? null; 429 $tiny_mce_filters = $GLOBALS['wp_filter']['tiny_mce_before_init'] ?? null; 430 431 remove_filter('content_save_pre', 'wp_filter_post_kses'); 432 remove_filter('content_filtered_save_pre', 'wp_filter_post_kses'); 433 remove_all_filters('the_content'); 434 remove_all_filters('the_editor_content'); 435 remove_all_filters('tiny_mce_before_init'); 436 437 wp_update_post(array( 438 'ID' => $post->ID, 439 'post_content' => $new_content 440 )); 441 442 if ($content_filters) { 443 $GLOBALS['wp_filter']['content_save_pre'] = $content_filters; 444 } 445 if ($content_filtered_filters) { 446 $GLOBALS['wp_filter']['content_filtered_save_pre'] = $content_filtered_filters; 447 } 448 if ($the_content_filters) { 449 $GLOBALS['wp_filter']['the_content'] = $the_content_filters; 450 } 451 if ($the_editor_content_filters) { 452 $GLOBALS['wp_filter']['the_editor_content'] = $the_editor_content_filters; 453 } 454 if ($tiny_mce_filters) { 455 $GLOBALS['wp_filter']['tiny_mce_before_init'] = $tiny_mce_filters; 456 } 457 } 458 } 459 460 wp_reset_postdata(); 461 } 462 463 add_action('topirank_after_last_batch', 'topirank_update_all_post_links'); -
topirank-integration/trunk/readme.txt
r3286404 r3289054 4 4 Requires at least: 6.0 5 5 Tested up to: 6.8 6 Stable tag: 2.0 6 Stable tag: 2.0.1 7 7 Requires PHP: 7.3 8 8 License: GPLv2 or later … … 66 66 67 67 == Changelog == 68 69 = 2.0.1 = 70 - Added version display. 71 - Fixed problem with internal links. 72 - Fixed problem with API requests. 68 73 69 74 = 2.0 = -
topirank-integration/trunk/topirank-integration.php
r3286404 r3289054 3 3 Plugin Name: Topirank Integration 4 4 Description: Plugin for parsing pages 5 Version: 2.0 5 Version: 2.0.1 6 6 Author: Topirank 7 7 License: GPLv2 or later … … 25 25 require_once plugin_dir_path(__FILE__) . 'includes/file-upload.php'; 26 26 require_once plugin_dir_path(__FILE__) . 'includes/extract-and-create.php'; 27 require_once plugin_dir_path(__FILE__) . 'includes/process-folders.php';28 27 require_once plugin_dir_path(__FILE__) . 'includes/helpers.php'; 29 28 require_once plugin_dir_path(__FILE__) . 'includes/api-integration.php'; … … 31 30 require_once plugin_dir_path(__FILE__) . 'includes/register-files.php'; 32 31 require_once plugin_dir_path(__FILE__) . 'includes/update-functionality.php'; 32 require_once plugin_dir_path(__FILE__) . 'includes/version-endpoint.php'; 33 33 34 34 register_activation_hook(__FILE__, 'topirank_generate_random_token');
Note: See TracChangeset
for help on using the changeset viewer.