Changeset 3229463
- Timestamp:
- 01/27/2025 12:00:04 PM (14 months ago)
- Location:
- crowdaa-sync
- Files:
-
- 13 edited
- 43 copied
-
tags/2.0.1 (copied) (copied from crowdaa-sync/trunk)
-
tags/2.0.1/CHANGELOG (copied) (copied from crowdaa-sync/trunk/CHANGELOG) (1 diff)
-
tags/2.0.1/README.txt (copied) (copied from crowdaa-sync/trunk/README.txt) (1 diff)
-
tags/2.0.1/admin/class-crowdaa-sync-add-info-api.php (copied) (copied from crowdaa-sync/trunk/admin/class-crowdaa-sync-add-info-api.php) (17 diffs)
-
tags/2.0.1/admin/class-crowdaa-sync-add-info-wp.php (copied) (copied from crowdaa-sync/trunk/admin/class-crowdaa-sync-add-info-wp.php) (16 diffs)
-
tags/2.0.1/admin/class-crowdaa-sync-admin-display.php (copied) (copied from crowdaa-sync/trunk/admin/class-crowdaa-sync-admin-display.php) (1 diff)
-
tags/2.0.1/admin/class-crowdaa-sync-admin.php (copied) (copied from crowdaa-sync/trunk/admin/class-crowdaa-sync-admin.php)
-
tags/2.0.1/admin/class-crowdaa-sync-api.php (copied) (copied from crowdaa-sync/trunk/admin/class-crowdaa-sync-api.php) (2 diffs)
-
tags/2.0.1/admin/class-crowdaa-sync-ext-hooks.php (copied) (copied from crowdaa-sync/trunk/admin/class-crowdaa-sync-ext-hooks.php)
-
tags/2.0.1/admin/class-crowdaa-sync-rest-api.php (copied) (copied from crowdaa-sync/trunk/admin/class-crowdaa-sync-rest-api.php)
-
tags/2.0.1/admin/class-crowdaa-sync-wp-hooks.php (copied) (copied from crowdaa-sync/trunk/admin/class-crowdaa-sync-wp-hooks.php)
-
tags/2.0.1/admin/css/crowdaa-sync-admin.css (copied) (copied from crowdaa-sync/trunk/admin/css/crowdaa-sync-admin.css)
-
tags/2.0.1/admin/js/crowdaa-sync-admin.js (copied) (copied from crowdaa-sync/trunk/admin/js/crowdaa-sync-admin.js)
-
tags/2.0.1/admin/partials/crowdaa-sync-admin-display.php (copied) (copied from crowdaa-sync/trunk/admin/partials/crowdaa-sync-admin-display.php) (4 diffs)
-
tags/2.0.1/crowdaa-sync.php (copied) (copied from crowdaa-sync/trunk/crowdaa-sync.php) (3 diffs)
-
tags/2.0.1/includes/class-crowdaa-sync-activator.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync-activator.php)
-
tags/2.0.1/includes/class-crowdaa-sync-deactivator.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync-deactivator.php)
-
tags/2.0.1/includes/class-crowdaa-sync-exception.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync-exception.php) (7 diffs)
-
tags/2.0.1/includes/class-crowdaa-sync-i18n.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync-i18n.php)
-
tags/2.0.1/includes/class-crowdaa-sync-loader.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync-loader.php)
-
tags/2.0.1/includes/class-crowdaa-sync-lock.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync-lock.php)
-
tags/2.0.1/includes/class-crowdaa-sync-logs.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync-logs.php)
-
tags/2.0.1/includes/class-crowdaa-sync-permissions.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync-permissions.php) (1 diff)
-
tags/2.0.1/includes/class-crowdaa-sync-syncdb.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync-syncdb.php) (4 diffs)
-
tags/2.0.1/includes/class-crowdaa-sync-timer.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync-timer.php)
-
tags/2.0.1/includes/class-crowdaa-sync-utils.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync-utils.php)
-
tags/2.0.1/includes/class-crowdaa-sync-versions.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync-versions.php)
-
tags/2.0.1/includes/class-crowdaa-sync.php (copied) (copied from crowdaa-sync/trunk/includes/class-crowdaa-sync.php)
-
tags/2.0.1/languages/crowdaa-sync-fr_FR.mo (copied) (copied from crowdaa-sync/trunk/languages/crowdaa-sync-fr_FR.mo)
-
tags/2.0.1/languages/crowdaa-sync-fr_FR.po (copied) (copied from crowdaa-sync/trunk/languages/crowdaa-sync-fr_FR.po) (11 diffs)
-
tags/2.0.1/vendor/autoload.php (copied) (copied from crowdaa-sync/trunk/vendor/autoload.php)
-
tags/2.0.1/vendor/composer/ClassLoader.php (copied) (copied from crowdaa-sync/trunk/vendor/composer/ClassLoader.php)
-
tags/2.0.1/vendor/composer/InstalledVersions.php (copied) (copied from crowdaa-sync/trunk/vendor/composer/InstalledVersions.php)
-
tags/2.0.1/vendor/composer/LICENSE (copied) (copied from crowdaa-sync/trunk/vendor/composer/LICENSE)
-
tags/2.0.1/vendor/composer/autoload_classmap.php (copied) (copied from crowdaa-sync/trunk/vendor/composer/autoload_classmap.php)
-
tags/2.0.1/vendor/composer/autoload_files.php (copied) (copied from crowdaa-sync/trunk/vendor/composer/autoload_files.php)
-
tags/2.0.1/vendor/composer/autoload_namespaces.php (copied) (copied from crowdaa-sync/trunk/vendor/composer/autoload_namespaces.php)
-
tags/2.0.1/vendor/composer/autoload_psr4.php (copied) (copied from crowdaa-sync/trunk/vendor/composer/autoload_psr4.php)
-
tags/2.0.1/vendor/composer/autoload_real.php (copied) (copied from crowdaa-sync/trunk/vendor/composer/autoload_real.php)
-
tags/2.0.1/vendor/composer/autoload_static.php (copied) (copied from crowdaa-sync/trunk/vendor/composer/autoload_static.php)
-
tags/2.0.1/vendor/composer/installed.json (copied) (copied from crowdaa-sync/trunk/vendor/composer/installed.json)
-
tags/2.0.1/vendor/composer/installed.php (copied) (copied from crowdaa-sync/trunk/vendor/composer/installed.php)
-
tags/2.0.1/vendor/composer/platform_check.php (copied) (copied from crowdaa-sync/trunk/vendor/composer/platform_check.php)
-
trunk/CHANGELOG (modified) (1 diff)
-
trunk/README.txt (modified) (1 diff)
-
trunk/admin/class-crowdaa-sync-add-info-api.php (modified) (17 diffs)
-
trunk/admin/class-crowdaa-sync-add-info-wp.php (modified) (16 diffs)
-
trunk/admin/class-crowdaa-sync-admin-display.php (modified) (1 diff)
-
trunk/admin/class-crowdaa-sync-api.php (modified) (2 diffs)
-
trunk/admin/partials/crowdaa-sync-admin-display.php (modified) (4 diffs)
-
trunk/crowdaa-sync.php (modified) (3 diffs)
-
trunk/includes/class-crowdaa-sync-exception.php (modified) (7 diffs)
-
trunk/includes/class-crowdaa-sync-permissions.php (modified) (1 diff)
-
trunk/includes/class-crowdaa-sync-syncdb.php (modified) (4 diffs)
-
trunk/languages/crowdaa-sync-fr_FR.mo (modified) (previous)
-
trunk/languages/crowdaa-sync-fr_FR.po (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
crowdaa-sync/tags/2.0.1/CHANGELOG
r3218183 r3229463 8 8 ## [Unreleased] 9 9 10 ## [1.10.8] - 2025-01-07 11 12 ### Changed 13 14 - Preventing Crowdaa API post deletion when WP>API sync is not enabled 15 16 ## [1.10.7] - 2025-01-03 17 18 ### Changed 19 20 - Fixed order of synchronization steps to remove elements before adding others, to avoid conflicts 10 ## [2.0.1] - 2025-01-27 11 12 ### Changed 13 14 - Added missing translations 15 - Now removing items first before adding new ones (categories, badges) to avoid duplicate issues 16 - Fixed an issue with articles unpublishing from WP to the API 17 - Preventing API posts deletion when deleting from WP when the WP>API sync is not enabled 18 19 ## [2.0.0] - 2024-12-13 20 21 This is marked as a major release beacause it will force a full re-synchronization of all articles. There are no breaking changes other than that. 22 23 ### Changed 24 25 - Reworked the synchronization process to use the update date from the API instead of the publication dates. It allows to : 26 - Synchronize unpublished articles and articles published at a future date both ways 21 27 22 28 ## [1.10.6] - 2024-12-04 -
crowdaa-sync/tags/2.0.1/README.txt
r3218183 r3229463 6 6 Requires PHP: 7.3 7 7 Tested up to: 5.9 8 Stable tag: 1.10.88 Stable tag: 2.0.1 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
crowdaa-sync/tags/2.0.1/admin/class-crowdaa-sync-add-info-api.php
r3216233 r3229463 279 279 ]; 280 280 } else if ( 281 $synced_by_wp_id[$id]->permission_hash !== $permission->hash && 281 ( 282 $synced_by_wp_id[$id]->permission_hash !== $permission->hash || 283 $sync_db->get_version() !== $synced_by_wp_id[$id]->sync_version 284 ) && 282 285 isset($badges_by_id[$synced_by_wp_id[$id]->api_id]) 283 286 ) { … … 315 318 ]; 316 319 } else if ( 317 $synced_by_api_id[$id]->badge_hash !== $badge->hash && 320 ( 321 $synced_by_api_id[$id]->badge_hash !== $badge->hash || 322 $sync_db->get_version() !== $synced_by_api_id[$id]->sync_version 323 ) && 318 324 isset($permissions_by_id[$synced_by_api_id[$id]->wp_id]) 319 325 ) { … … 365 371 $categories_by_id = []; 366 372 $sync_api = new Crowdaa_Sync_API(); 367 $sync_db = new Crowdaa_Sync_Syncdb('categories');373 $sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 368 374 $synced = $sync_db->get_synced_entries(); 369 375 $all_categories = $sync_api->get_categories(); … … 532 538 ]; 533 539 } else if ( 534 $synced_by_wp_id[$id]->term_hash !== $term->hash && 540 ( 541 $synced_by_wp_id[$id]->term_hash !== $term->hash || 542 $sync_db->get_version() !== $synced_by_wp_id[$id]->sync_version 543 ) && 535 544 isset($categories_by_id[$synced_by_wp_id[$id]->api_id]) 536 545 ) { … … 578 587 ]; 579 588 } else if ( 580 $synced_by_api_id[$id]->category_hash !== $category->hash && 589 ( 590 $synced_by_api_id[$id]->category_hash !== $category->hash || 591 $sync_db->get_version() !== $synced_by_api_id[$id]->sync_version 592 ) && 581 593 isset($terms_by_id[$synced_by_api_id[$id]->wp_id]) 582 594 ) { … … 648 660 'start' => '0', 649 661 'limit' => $fetch_batch_count, 662 'sortBy' => 'updatedAt', 650 663 'getAuthors' => 'false', 651 664 'getDrafts' => 'false', 652 665 'getOrphansArticles' => 'false', 653 666 'getPictures' => 'false', 654 'onlyPublished' => ' true',667 'onlyPublished' => 'false', 655 668 'showHiddenOnFeed' => 'true', 656 669 'showWithHiddenCategories' => 'false', … … 668 681 669 682 foreach ($api_posts->articles as $api_data) { 670 $update_date_unix = strtotime($api_data-> publicationDate);683 $update_date_unix = strtotime($api_data->updatedAt); 671 684 if ($update_date_unix > $oldest_api_post) { 672 685 $oldest_api_post = $update_date_unix; … … 690 703 $posts_table.post_modified_gmt >= %s AND 691 704 $posts_table.post_type = %s AND 692 $posts_table.post_status = %s705 $posts_table.post_status IN (%s, %s, %s) 693 706 ORDER BY $posts_table.post_modified_gmt ASC 694 707 LIMIT 0, %d", … … 696 709 'post', 697 710 'publish', 711 'future', 712 'draft', 698 713 $fetch_batch_count 699 714 ); … … 733 748 foreach ($all_api_posts as $api_post) { 734 749 $api_post_id = $api_post['api_id']; 735 if (!array_key_exists($api_post_id, $all_wp_posts)) { 750 if (array_key_exists($api_post_id, $all_wp_posts)) { 751 $wp_post = $all_wp_posts[$api_post_id]; 752 } else { 736 753 $raw_wp_post = get_posts([ 737 754 'post_type' => 'post', … … 753 770 $wp_post['post_name'] = $raw_wp_post->post_title; 754 771 $wp_post['update_date_unix'] = strtotime($raw_wp_post->post_modified_gmt); 755 } else {756 $wp_post = $all_wp_posts[$api_post_id]; 757 }758 759 if ($api_post['update_date_unix'] > $wp_post['update_date_unix']) { 760 $last_sync = get_post_meta($wp_post['post_id'], 'crowdaa_last_wp_to_api_sync', true) ?: 0;761 if ($api_post['update_date_unix'] > $last_sync) {772 } 773 774 $last_api_sync = strtotime(get_post_meta($wp_post['post_id'], 'crowdaa_last_api_update', true)); 775 $last_wp_sync = strtotime(get_post_meta($wp_post['post_id'], 'crowdaa_last_wp_update', true)); 776 777 if ($api_post['update_date_unix'] !== $last_api_sync && $wp_post['update_date_unix'] !== $last_wp_sync) { 778 if ($api_post['update_date_unix'] >= $wp_post['update_date_unix']) { 762 779 $result['api_to_wp'][] = $api_post; 780 } else { 781 $result['wp_to_api'][] = $api_post; 763 782 } 764 783 unset($all_wp_posts[$api_post_id]); 765 784 unset($all_api_posts[$api_post_id]); 766 } elseif ($api_post['update_date_unix'] <= $wp_post['update_date_unix']) { 785 } else if ($api_post['update_date_unix'] !== $last_api_sync) { 786 $result['api_to_wp'][] = $api_post; 787 unset($all_wp_posts[$api_post_id]); 788 unset($all_api_posts[$api_post_id]); 789 } else if ($wp_post['update_date_unix'] !== $last_wp_sync) { 790 $result['wp_to_api'][] = $api_post; 791 unset($all_wp_posts[$api_post_id]); 792 unset($all_api_posts[$api_post_id]); 793 } else { 767 794 $need_sync = get_post_meta($wp_post['post_id'], 'crowdaa_need_sync', true); 768 795 $sync_version = get_post_meta($wp_post['post_id'], 'crowdaa_version', true); … … 1062 1089 delete_post_meta($post_id, 'crowdaa_need_sync'); 1063 1090 delete_post_meta($post_id, 'crowdaa_version'); 1064 delete_post_meta($post_id, 'crowdaa_last_wp_to_api_sync'); 1091 delete_post_meta($post_id, 'crowdaa_last_api_update'); 1092 delete_post_meta($post_id, 'crowdaa_last_wp_update'); 1065 1093 delete_post_meta($post_id, 'api_post_id'); 1066 1094 } … … 1151 1179 } 1152 1180 $sync_api = new Crowdaa_Sync_API(); 1153 $sync_db = new Crowdaa_Sync_Syncdb('categories');1181 $sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 1154 1182 $errors = []; 1155 1183 … … 1244 1272 $errors = []; 1245 1273 $sync_api = new Crowdaa_Sync_API(); 1246 $cat_sync_db = new Crowdaa_Sync_Syncdb('categories');1274 $cat_sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 1247 1275 $cat_synced_entries = $cat_sync_db->get_synced_entries(); 1248 1276 … … 1270 1298 1271 1299 // Get category. On multiple categories, pick childless ones first 1272 $child_term = false;1273 1300 $post_terms = get_the_terms($post['post_id'], 'category'); 1274 1301 if (empty($post_terms)) { … … 1370 1397 } 1371 1398 1399 $api_whole_post = $sync_api->get_article($post['api_id']); 1400 $wp_whole_post = get_post($post['post_id']); 1401 1372 1402 update_post_meta($post['post_id'], 'crowdaa_need_sync', 'no'); 1373 1403 update_post_meta($post['post_id'], 'crowdaa_version', Crowdaa_Sync_Versions::get_version()); 1374 update_post_meta($post['post_id'], 'crowdaa_last_wp_to_api_sync', time()); 1404 update_post_meta($post['post_id'], 'crowdaa_last_api_update', $api_whole_post->updatedAt); 1405 update_post_meta($post['post_id'], 'crowdaa_last_wp_update', $wp_whole_post->post_modified_gmt); 1375 1406 } 1376 1407 … … 1398 1429 { 1399 1430 $missing = []; 1400 $result_code = null;1401 $output = null;1402 1431 1403 1432 $default_image = get_option('default_image'); -
crowdaa-sync/tags/2.0.1/admin/class-crowdaa-sync-add-info-wp.php
r3216233 r3229463 143 143 ) { 144 144 $errors = []; 145 $sync_db = new Crowdaa_Sync_Syncdb('categories');145 $sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 146 146 $categories_sync_to_wp = array_merge($remove_wp, $api_to_wp, $only_api); 147 147 … … 261 261 private function create_wp_post_from_api($api_data) 262 262 { 263 $created_posts = []; 264 $cat_sync_db = new Crowdaa_Sync_Syncdb('categories'); 263 $cat_sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 265 264 266 265 if (isset($api_data->categories) && count($api_data->categories) > 0) { … … 276 275 } 277 276 278 //$publicationTime = self::api_date_to_unix($api_data->publicationDate);277 $publicationTime = self::api_date_to_unix($api_data->publicationDate); 279 278 $post_data = [ 280 279 'post_title' => $api_data->title, 281 280 'post_content' => $api_data->text, 282 //'post_date' => date('Y-m-d H:i:s', $publicationTime),283 //'post_date_gmt' => gmdate('Y-m-d H:i:s', $publicationTime),281 'post_date' => date('Y-m-d H:i:s', $publicationTime), 282 'post_date_gmt' => gmdate('Y-m-d H:i:s', $publicationTime), 284 283 'post_status' => 'publish', 285 284 'post_type' => 'post', 286 285 'post_author' => get_current_user_id(), 287 286 ]; 288 // if ($publicationTime > time()) { 289 // $data['post_status'] = 'future'; 290 // } 287 if ($publicationTime > time()) { 288 $data['post_status'] = 'future'; 289 } else if (!$api_data->isPublished) { 290 $data['post_status'] = 'draft'; 291 } else { 292 $data['post_status'] = 'publish'; 293 } 291 294 292 295 $wp_post_id = wp_insert_post($post_data); … … 315 318 } 316 319 320 $wp_whole_post = get_post($wp_post_id); 317 321 update_post_meta($wp_post_id, 'crowdaa_need_sync', 'no'); 318 322 update_post_meta($wp_post_id, 'crowdaa_version', Crowdaa_Sync_Versions::get_version()); 323 update_post_meta($wp_post_id, 'crowdaa_last_api_update', $api_data->updatedAt); 324 update_post_meta($wp_post_id, 'crowdaa_last_wp_update', $wp_whole_post->post_modified_gmt); 319 325 320 326 Crowdaa_Sync_Logs::log('Created WP post', $wp_post_id); … … 323 329 } 324 330 325 // private static function api_date_to_unix($date) { 326 // $matches = []; 327 // preg_match('/^(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)\.\d+Z/', $date, $matches); 328 // $time = gmmktime( 329 // intval($matches[4], 10), 330 // intval($matches[5], 10), 331 // intval($matches[6], 10), 332 // intval($matches[2], 10), 333 // intval($matches[3], 10), 334 // intval($matches[1], 10), 335 // ); 336 // return ($time); 337 // } 331 private static function api_date_to_unix($date) 332 { 333 $matches = []; 334 preg_match('/^(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)\.\d+Z/', $date, $matches); 335 $time = gmmktime( 336 intval($matches[4], 10), 337 intval($matches[5], 10), 338 intval($matches[6], 10), 339 intval($matches[2], 10), 340 intval($matches[3], 10), 341 intval($matches[1], 10), 342 ); 343 return ($time); 344 } 338 345 339 346 private function update_wp_post_from_api($api_data, $wp_post_id) 340 347 { 341 $created_posts = []; 342 $cat_sync_db = new Crowdaa_Sync_Syncdb('categories'); 348 $cat_sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 343 349 344 350 if (isset($api_data->categories) && count($api_data->categories) > 0) { … … 354 360 } 355 361 356 //$publicationTime = self::api_date_to_unix($api_data->publicationDate);362 $publicationTime = self::api_date_to_unix($api_data->publicationDate); 357 363 $data = [ 358 364 'ID' => $wp_post_id, 359 365 'post_title' => $api_data->title, 360 366 'post_content' => $api_data->text, 361 //'post_date' => date('Y-m-d H:i:s', $publicationTime),362 //'post_date_gmt' => gmdate('Y-m-d H:i:s', $publicationTime),367 'post_date' => date('Y-m-d H:i:s', $publicationTime), 368 'post_date_gmt' => gmdate('Y-m-d H:i:s', $publicationTime), 363 369 ]; 364 // if ($publicationTime > time()) { 365 // $data['post_status'] = 'future'; 366 // } 370 if ($publicationTime > time()) { 371 $data['post_status'] = 'future'; 372 } else if (!$api_data->isPublished) { 373 $data['post_status'] = 'draft'; 374 } else { 375 $data['post_status'] = 'publish'; 376 } 367 377 368 378 wp_set_post_terms($wp_post_id, $terms, 'category'); … … 391 401 } 392 402 403 $wp_whole_post = get_post($wp_post_id); 393 404 update_post_meta($wp_post_id, 'crowdaa_need_sync', 'no'); 394 405 update_post_meta($wp_post_id, 'crowdaa_version', Crowdaa_Sync_Versions::get_version()); 406 update_post_meta($wp_post_id, 'crowdaa_last_api_update', $api_data->updatedAt); 407 update_post_meta($wp_post_id, 'crowdaa_last_wp_update', $wp_whole_post->post_modified_gmt); 395 408 396 409 Crowdaa_Sync_Logs::log('Updated WP post', $wp_post_id, $api_data->_id); … … 497 510 ])); 498 511 } catch (\Throwable $e) { 499 Crowdaa_Sync_Logs::log('Set WP term feed picture error', $e->getMessage());500 512 throw new Crowdaa_Sync_Category_Error(__('Set WP term feed picture error : ', CROWDAA_SYNC_PLUGIN_NAME) . $e->getMessage()); 501 513 } … … 574 586 $fetch_err = $this->get_uploads($feed_pic_url, $feed_pic_name); 575 587 if ($fetch_err) { 576 $errors[] = $fetch_err;588 throw new Crowdaa_Sync_Post_Error(__('Feed image synchronization error (download) : ', CROWDAA_SYNC_PLUGIN_NAME) . $fetch_err); 577 589 } 578 590 } … … 581 593 $attachment_id = $this->set_uploads($wp_post_id, $feed_pic_name, true); 582 594 } catch (\Throwable $e) { 583 Crowdaa_Sync_Logs::log('Set WP post feed picture error', $e->getMessage()); 584 $errors[] = $e->getMessage(); 585 return; 595 throw new Crowdaa_Sync_Post_Error(__('Feed image synchronization error (storage) : ', CROWDAA_SYNC_PLUGIN_NAME) . $e->getMessage()); 586 596 } 587 597 update_post_meta($wp_post_id, 'api_feedpicture_id', serialize([ … … 631 641 $fetch_err = $this->get_uploads($image_url, $image_name); 632 642 if ($fetch_err) { 633 $errors[] = $fetch_err; 634 continue; 643 throw new Crowdaa_Sync_Post_Error(__('Image synchronization error (download) : ', CROWDAA_SYNC_PLUGIN_NAME) . $fetch_err); 635 644 } 636 645 } … … 640 649 $images_map[$image_id] = $attachment_id; 641 650 } catch (\Throwable $e) { 642 Crowdaa_Sync_Logs::log('Set WP post image error', $e->getMessage()); 643 $errors[] = $e->getMessage(); 644 continue; 651 throw new Crowdaa_Sync_Post_Error(__('Image synchronization error (storage) : ', CROWDAA_SYNC_PLUGIN_NAME) . $e->getMessage()); 645 652 } 646 653 } … … 680 687 $convert_error = $this->ffmpeg_video_converter($video->url, $video_name); 681 688 if ($convert_error) { 682 $errors[] = $convert_error; 683 continue; 689 throw new Crowdaa_Sync_Post_Error(__('Video synchronization error (convert) : ', CROWDAA_SYNC_PLUGIN_NAME) . $convert_error); 684 690 } 685 691 } … … 689 695 $videos_map[$video_id] = $attachment_id; 690 696 } catch (\Throwable $e) { 691 Crowdaa_Sync_Logs::log('Set WP post video error', $e->getMessage()); 692 $errors[] = $e->getMessage(); 693 continue; 697 throw new Crowdaa_Sync_Post_Error(__('Video synchronization error (storage) : ', CROWDAA_SYNC_PLUGIN_NAME) . $e->getMessage()); 694 698 } 695 699 } … … 834 838 835 839 try { 836 wp_remote_get($img_url, [840 $ret = wp_remote_get($img_url, [ 837 841 'method' => 'GET', 838 842 'timeout' => 45, … … 841 845 'sslcertificates' => CROWDAA_SYNC_CACERT_PATH, 842 846 ]); 847 848 if (is_wp_error($ret)) { 849 return $ret->get_error_message(); 850 } 843 851 844 852 return (false); -
crowdaa-sync/tags/2.0.1/admin/class-crowdaa-sync-admin-display.php
r3202416 r3229463 41 41 Crowdaa_Sync_Permissions::reset(); 42 42 43 $sync_db = new Crowdaa_Sync_Syncdb('categories');43 $sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 44 44 $sync_db->reset(); 45 45 -
crowdaa-sync/tags/2.0.1/admin/class-crowdaa-sync-api.php
r3169735 r3229463 254 254 } 255 255 256 $send_notification = ( 257 get_post_meta($wp_post_id, 'crowdaa_notification_send', true) === 'yes' && 258 get_post_meta($wp_post_id, 'crowdaa_notification_sent', true) !== 'yes' 259 ); 260 $publish_error = $this->publish_post_draft_api( 261 $json->draftId, 262 $api_post_id, 263 $publication_time, 264 $send_notification, 265 (get_post_meta($wp_post_id, 'crowdaa_notification_content', true) ?: null), 266 (get_post_meta($wp_post_id, 'crowdaa_notification_title', true) ?: null), 267 ); 268 if ($publish_error) { 269 Crowdaa_Sync_Logs::log('Article publish error', $api_post_id, $publish_error); 270 throw new Crowdaa_Sync_Post_Error(__('Post publish error : ', CROWDAA_SYNC_PLUGIN_NAME) . $publish_error); 271 } 272 273 if ($send_notification) { 274 update_post_meta($wp_post_id, 'crowdaa_notification_sent', 'yes'); 275 } 276 277 Crowdaa_Sync_Logs::log('Updated API article successfully', $api_post_id, $json->draftId); 278 } 279 } 280 256 $post_status = get_post_status($wp_post_id); 257 if ($post_status === 'draft') { 258 Crowdaa_Sync_Logs::log('Updated API post (draft)', $json->articleId); 259 $this->unpublish_api_article($json->articleId); 260 } else { 261 $send_notification = ( 262 get_post_meta($wp_post_id, 'crowdaa_notification_send', true) === 'yes' && 263 get_post_meta($wp_post_id, 'crowdaa_notification_sent', true) !== 'yes' 264 ); 265 $publish_error = $this->publish_post_draft_api( 266 $json->draftId, 267 $api_post_id, 268 $publication_time, 269 $send_notification, 270 (get_post_meta($wp_post_id, 'crowdaa_notification_content', true) ?: null), 271 (get_post_meta($wp_post_id, 'crowdaa_notification_title', true) ?: null), 272 ); 273 if ($publish_error) { 274 Crowdaa_Sync_Logs::log('Article publish error', $api_post_id, $publish_error); 275 throw new Crowdaa_Sync_Post_Error(__('Post publish error : ', CROWDAA_SYNC_PLUGIN_NAME) . $publish_error); 276 } 277 278 if ($send_notification) { 279 update_post_meta($wp_post_id, 'crowdaa_notification_sent', 'yes'); 280 } 281 282 Crowdaa_Sync_Logs::log('Updated API article successfully', $api_post_id, $json->draftId); 283 } 284 } 285 } 286 287 public function unpublish_api_article($api_post_id) 288 { 289 $url = '/press/articles/' . rawurlencode($api_post_id) . '/unpublish'; 290 $response = $this->http_request('PUT', $url); 291 $err = is_wp_error($response) ? $response->get_error_message() : null; 292 if (!$err) { 293 $body = wp_remote_retrieve_body($response); 294 $json = json_decode($body); 295 } 296 297 if ($err) { 298 Crowdaa_Sync_Logs::log('Unpublish article query error', $api_post_id, $err); 299 return ((object) [ 300 'message' => $err, 301 ]); 302 } 303 304 if (isset($json->message)) { 305 Crowdaa_Sync_Logs::log('Unpublish article error', $json->message); 306 } 307 308 return ($json); 309 } 281 310 282 311 /** … … 541 570 } 542 571 543 $send_notification = ( 544 get_post_meta($wp_post_id, 'crowdaa_notification_send', true) === 'yes' && 545 get_post_meta($wp_post_id, 'crowdaa_notification_sent', true) !== 'yes' 546 ); 547 $publish_error = $this->publish_post_draft_api( 548 $json->draftId, 549 $json->articleId, 550 $publication_time, 551 $send_notification, 552 (get_post_meta($wp_post_id, 'crowdaa_notification_content', true) ?: null), 553 (get_post_meta($wp_post_id, 'crowdaa_notification_title', true) ?: null), 554 ); 555 if ($publish_error) { 556 Crowdaa_Sync_Logs::log('Article first publish error', $json->articleId, $json->draftId, $publish_error); 557 throw new Crowdaa_Sync_Post_Error(__('Post first publish error : ', CROWDAA_SYNC_PLUGIN_NAME) . $publish_error); 558 } 559 560 update_post_meta($wp_post_id, 'api_post_id', $json->articleId); 561 if ($send_notification) { 562 update_post_meta($wp_post_id, 'crowdaa_notification_sent', 'yes'); 563 } 564 Crowdaa_Sync_Logs::log('Created API post', $json->articleId); 572 $post_status = get_post_status($wp_post_id); 573 if ($post_status === 'draft') { 574 Crowdaa_Sync_Logs::log('Updated API post (draft)', $json->articleId); 575 $this->unpublish_api_article($json->articleId); 576 } else { 577 $send_notification = ( 578 get_post_meta($wp_post_id, 'crowdaa_notification_send', true) === 'yes' && 579 get_post_meta($wp_post_id, 'crowdaa_notification_sent', true) !== 'yes' 580 ); 581 $publish_error = $this->publish_post_draft_api( 582 $json->draftId, 583 $json->articleId, 584 $publication_time, 585 $send_notification, 586 (get_post_meta($wp_post_id, 'crowdaa_notification_content', true) ?: null), 587 (get_post_meta($wp_post_id, 'crowdaa_notification_title', true) ?: null), 588 ); 589 if ($publish_error) { 590 Crowdaa_Sync_Logs::log('Article first publish error', $json->articleId, $json->draftId, $publish_error); 591 throw new Crowdaa_Sync_Post_Error(__('Post first publish error : ', CROWDAA_SYNC_PLUGIN_NAME) . $publish_error); 592 } 593 594 update_post_meta($wp_post_id, 'api_post_id', $json->articleId); 595 if ($send_notification) { 596 update_post_meta($wp_post_id, 'crowdaa_notification_sent', 'yes'); 597 } 598 599 Crowdaa_Sync_Logs::log('Created API post', $json->articleId); 600 } 601 602 return $json->articleId; 565 603 } 566 604 } -
crowdaa-sync/tags/2.0.1/admin/partials/crowdaa-sync-admin-display.php
r3169735 r3229463 198 198 <br /> 199 199 <?php wp_nonce_field('crowdaa_cron_sync_enabled_data', 'crowdaa_cron_sync_enabled'); ?> 200 <?php submit_button( 'Save parameters'); ?>200 <?php submit_button(__('Save parameters', CROWDAA_SYNC_PLUGIN_NAME)); ?> 201 201 </form> 202 202 </div> … … 221 221 <input type="file" required name="file" id="image_file" accept=".jpg, .jpeg, .png" /> 222 222 <?php 223 submit_button( 'Save picture');223 submit_button(__('Save picture', CROWDAA_SYNC_PLUGIN_NAME)); 224 224 ?> 225 225 </form> … … 275 275 <?php wp_nonce_field('crowdaa_set_sync_categories_data', 'crowdaa_set_sync_categories'); ?> 276 276 <?php 277 submit_button( 'Save mode & categories');277 submit_button(__('Save mode & categories', CROWDAA_SYNC_PLUGIN_NAME)); 278 278 ?> 279 279 </form> … … 323 323 <?php wp_nonce_field('crowdaa_set_feed_categories_data', 'crowdaa_set_feed_categories'); ?> 324 324 <?php 325 submit_button( 'Save feed categories');325 submit_button(__('Save feed categories', CROWDAA_SYNC_PLUGIN_NAME)); 326 326 ?> 327 327 </form> -
crowdaa-sync/tags/2.0.1/crowdaa-sync.php
r3218183 r3229463 14 14 * Plugin URI: 15 15 * Description: Plugin for synchronizing WordPress site and Crowdaa CMS 16 * Version: 1.10.816 * Version: 2.0.1 17 17 * Requires at least: 5.5 18 18 * Requires PHP: 7.2 … … 34 34 * Uses SemVer - https://semver.org 35 35 */ 36 define('CROWDAA_SYNC_VERSION', ' 1.10.8');36 define('CROWDAA_SYNC_VERSION', '2.0.1'); 37 37 define('CROWDAA_SYNC_PLUGIN_DIR', __DIR__); 38 38 define('CROWDAA_SYNC_PLUGIN_NAME', 'crowdaa-sync'); … … 44 44 * Just bump the version, it will handle the rest. 45 45 */ 46 define('CROWDAA_SYNC_META_VERSION', ' 3');46 define('CROWDAA_SYNC_META_VERSION', '4'); 47 47 48 48 $last_version = get_option('crowdaa_last_version', false); -
crowdaa-sync/tags/2.0.1/includes/class-crowdaa-sync-exception.php
r3149200 r3229463 11 11 */ 12 12 13 class Crowdaa_Sync_Generic_Exception extends Exception 14 { 15 public function __construct($message = 'NO_MESSAGE_GIVEN', ...$extra) 16 { 17 parent::__construct($message); 18 19 $to_log = $message; 20 if ($extra) { 21 foreach ($extra as $item) { 22 if (!is_string($item)) { 23 $to_log .= '|' . print_r($item, true); 24 } else { 25 $to_log .= '|' . $item; 26 } 27 } 28 } 29 30 Crowdaa_Sync_Logs::log((new \ReflectionClass($this))->getShortName(), '__construct() called with', $to_log); 31 } 32 } 33 13 34 /** 14 35 * The base project exception, when a fatal error occurs. … … 21 42 * @author Crowdaa <contact@crowdaa.com> 22 43 */ 23 class Crowdaa_Sync_Error extends Exception 24 { 25 } 44 class Crowdaa_Sync_Error extends Crowdaa_Sync_Generic_Exception {} 26 45 27 46 /** … … 33 52 * @author Crowdaa <contact@crowdaa.com> 34 53 */ 35 class Crowdaa_Sync_Badge_Error extends Exception 36 { 37 } 54 class Crowdaa_Sync_Badge_Error extends Crowdaa_Sync_Generic_Exception {} 38 55 39 56 /** … … 45 62 * @author Crowdaa <contact@crowdaa.com> 46 63 */ 47 class Crowdaa_Sync_Category_Error extends Exception 48 { 49 } 64 class Crowdaa_Sync_Category_Error extends Crowdaa_Sync_Generic_Exception {} 50 65 51 66 /** … … 57 72 * @author Crowdaa <contact@crowdaa.com> 58 73 */ 59 class Crowdaa_Sync_Post_Error extends Exception 60 { 61 } 74 class Crowdaa_Sync_Post_Error extends Crowdaa_Sync_Generic_Exception {} 62 75 63 76 /** … … 69 82 * @author Crowdaa <contact@crowdaa.com> 70 83 */ 71 class Crowdaa_Sync_Post_Skip_Error extends Crowdaa_Sync_Post_Error 72 { 73 } 84 class Crowdaa_Sync_Post_Skip_Error extends Crowdaa_Sync_Post_Error {} 74 85 75 86 /** … … 81 92 * @author Crowdaa <contact@crowdaa.com> 82 93 */ 83 class Crowdaa_Sync_Timeout_Error extends Exception 84 { 85 } 94 class Crowdaa_Sync_Timeout_Error extends Crowdaa_Sync_Generic_Exception {} -
crowdaa-sync/tags/2.0.1/includes/class-crowdaa-sync-permissions.php
r3179247 r3229463 129 129 public static function sync_db() 130 130 { 131 return ( new Crowdaa_Sync_Syncdb('user_badges'));131 return (Crowdaa_Sync_Syncdb::instance('user_badges')); 132 132 } 133 133 -
crowdaa-sync/tags/2.0.1/includes/class-crowdaa-sync-syncdb.php
r3195042 r3229463 16 16 private static $loaded = array(); 17 17 18 public static function instance($tableName) 19 { 20 switch ($tableName) { 21 case 'categories': 22 case 'user_badges': 23 return new self($tableName, CROWDAA_SYNC_META_VERSION); 24 break; 25 default: 26 return new self($tableName); 27 break; 28 } 29 } 30 18 31 /** 19 32 * Initialize the database. … … 49 62 } 50 63 64 public function get_version() 65 { 66 return $this->version; 67 } 68 51 69 /** 52 70 * Returns an assoc array of synced elements, with the provided fields (null means all) … … 151 169 if (isset($v->sync_data)) { 152 170 $v->sync_data = unserialize($v->sync_data); 171 } else { 172 $v->sync_data = []; 153 173 } 154 174 } … … 266 286 return (array_pop($result)); 267 287 } 288 289 /** 290 * Delete an entry with the specified internal ID. 291 */ 292 public function delete_entry_with_id($id) 293 { 294 global $wpdb; 295 296 list($whereStr, $whereArg) = self::prepare_wherein($id, 'id'); 297 298 $wpdb->get_results($wpdb->prepare("DELETE FROM `$this->tableName` WHERE $whereStr", ...$whereArg), OBJECT_K); 299 } 268 300 } -
crowdaa-sync/tags/2.0.1/languages/crowdaa-sync-fr_FR.po
r3169735 r3229463 3 3 "Project-Id-Version: WpCrowdaaSyncTranslations\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 2024-1 0-15 17:46+0400\n"6 "PO-Revision-Date: 2024-1 0-15 17:47+0400\n"5 "POT-Creation-Date: 2024-12-16 10:58+0400\n" 6 "PO-Revision-Date: 2024-12-16 11:05+0400\n" 7 7 "Last-Translator: \n" 8 8 "Language-Team: Français\n" … … 12 12 "Content-Transfer-Encoding: 8bit\n" 13 13 "Plural-Forms: nplurals=2; plural=(n > 1);\n" 14 "X-Generator: Poedit 3. 2.2\n"14 "X-Generator: Poedit 3.4.2\n" 15 15 "X-Poedit-Basepath: ..\n" 16 16 "X-Poedit-KeywordsList: __;_e;esc_html_e;esc_attr_e\n" … … 24 24 25 25 #: admin/class-crowdaa-sync-add-info-api.php:217 26 #: admin/class-crowdaa-sync-add-info-api.php:6 3026 #: admin/class-crowdaa-sync-add-info-api.php:643 27 27 msgid "User is not connected" 28 28 msgstr "Utilisateur non connecté" 29 29 30 30 #: admin/class-crowdaa-sync-add-info-api.php:245 31 #: admin/class-crowdaa-sync-add-info-api.php:37 232 #: admin/class-crowdaa-sync-add-info-api.php:6 6031 #: admin/class-crowdaa-sync-add-info-api.php:378 32 #: admin/class-crowdaa-sync-add-info-api.php:674 33 33 msgid "API query error : " 34 34 msgstr "Erreur de requête d'API :" 35 35 36 #: admin/class-crowdaa-sync-add-info-api.php:8 2736 #: admin/class-crowdaa-sync-add-info-api.php:855 37 37 msgid "The synchronization cannot be done, missing dependencies : " 38 38 msgstr "La synchronisation ne peut se faire, dépendances manquantes :" 39 39 40 #: admin/class-crowdaa-sync-add-info-api.php:8 3240 #: admin/class-crowdaa-sync-add-info-api.php:860 41 41 msgid "Cannot run : a synchronization is already running" 42 42 msgstr "Une synchronisation est déjà en cours, merci de réessayer plus tard" 43 43 44 #: admin/class-crowdaa-sync-add-info-api.php:9 6644 #: admin/class-crowdaa-sync-add-info-api.php:994 45 45 msgid "Some errors happened during synchronization : " 46 46 msgstr "Des erreurs ont eu lieu pendant la synchronisation :" 47 47 48 #: admin/class-crowdaa-sync-add-info-api.php:9 6948 #: admin/class-crowdaa-sync-add-info-api.php:997 49 49 msgid "All data synced successfully" 50 50 msgstr "Données synchronisées avec succès" 51 51 52 #: admin/class-crowdaa-sync-add-info-api.php: 97452 #: admin/class-crowdaa-sync-add-info-api.php:1002 53 53 msgid "" 54 54 "The synchronization process timed out, please retry it until it succeeds." … … 57 57 "relancer jusqu'à ce que qu'elle se termine entièrement." 58 58 59 #: admin/class-crowdaa-sync-add-info-api.php: 97659 #: admin/class-crowdaa-sync-add-info-api.php:1004 60 60 msgid "Uncaught Post synchronization error : " 61 msgstr " "62 63 #: admin/class-crowdaa-sync-add-info-api.php: 97861 msgstr "Erreur non rattrapée de synchronsation de post : " 62 63 #: admin/class-crowdaa-sync-add-info-api.php:1006 64 64 msgid "Category synchronization error : " 65 msgstr " "66 67 #: admin/class-crowdaa-sync-add-info-api.php: 98065 msgstr "Erreur de synchronisation de catégorie : " 66 67 #: admin/class-crowdaa-sync-add-info-api.php:1008 68 68 msgid "Badge synchronization error : " 69 msgstr " "70 71 #: admin/class-crowdaa-sync-add-info-api.php: 98269 msgstr "Erreur de synchronisation de badge : " 70 71 #: admin/class-crowdaa-sync-add-info-api.php:1010 72 72 msgid "Fatal synchronization error : " 73 msgstr " "74 75 #: admin/class-crowdaa-sync-add-info-api.php: 98473 msgstr "Erreur de synchronisation fatale : " 74 75 #: admin/class-crowdaa-sync-add-info-api.php:1012 76 76 msgid "Unknown synchronzation error : " 77 msgstr " "78 79 #: admin/class-crowdaa-sync-add-info-wp.php: 49077 msgstr "Erreur de synchronisation inconnue : " 78 79 #: admin/class-crowdaa-sync-add-info-wp.php:501 80 80 msgid "Errors when downloading term image for " 81 msgstr " "82 83 #: admin/class-crowdaa-sync-add-info-wp.php:5 0281 msgstr "Erreur de téléchargement de l'image de catégorie pour " 82 83 #: admin/class-crowdaa-sync-add-info-wp.php:512 84 84 msgid "Set WP term feed picture error : " 85 msgstr "" 86 87 #: admin/class-crowdaa-sync-add-info-wp.php:869 85 msgstr "Erreur de définition de l'image du feed :" 86 87 #: admin/class-crowdaa-sync-add-info-wp.php:588 88 msgid "Feed image synchronization error (download) : " 89 msgstr "Erreur de synchronisation de l'image du feed (téléchargement) :" 90 91 #: admin/class-crowdaa-sync-add-info-wp.php:595 92 msgid "Feed image synchronization error (storage) : " 93 msgstr "Erreur de synchronisation de l'image du feed (stockage) :" 94 95 #: admin/class-crowdaa-sync-add-info-wp.php:643 96 msgid "Image synchronization error (download) : " 97 msgstr "Erreur de synchronisation d'image (téléchargement) :" 98 99 #: admin/class-crowdaa-sync-add-info-wp.php:651 100 msgid "Image synchronization error (storage) : " 101 msgstr "Erreur de synchronisation d'image (stockage) :" 102 103 #: admin/class-crowdaa-sync-add-info-wp.php:689 104 msgid "Video synchronization error (convert) : " 105 msgstr "Erreur de synchronisation de vidéo (conversion) :" 106 107 #: admin/class-crowdaa-sync-add-info-wp.php:697 108 msgid "Video synchronization error (storage) : " 109 msgstr "Erreur de synchronisation de vidéo (stockage) :" 110 111 #: admin/class-crowdaa-sync-add-info-wp.php:875 88 112 msgid "" 89 113 "You don't have ffmpeg installed on your server to download videos, please " … … 94 118 "hébergeur" 95 119 96 #: admin/class-crowdaa-sync-admin-display.php: 19797 #: admin/class-crowdaa-sync-admin-display.php:2 08120 #: admin/class-crowdaa-sync-admin-display.php:205 121 #: admin/class-crowdaa-sync-admin-display.php:216 98 122 msgid "Failed to get data. Please try again later" 99 123 msgstr "Communication réseau impossible, merci de réessayer ultérieurement" 100 124 101 #: admin/class-crowdaa-sync-admin-display.php:2 19125 #: admin/class-crowdaa-sync-admin-display.php:227 102 126 msgid "Data is incorrect please double-check and try again" 103 127 msgstr "Les données sont incorrectes, merci de vérifier les paramètres fournis" 104 128 105 #: admin/class-crowdaa-sync-admin-display.php:2 47129 #: admin/class-crowdaa-sync-admin-display.php:255 106 130 msgid "Failed to complete login initialization process" 107 131 msgstr "Échec d'initialisation du plugin, merci de réessayer" 108 132 109 #: admin/class-crowdaa-sync-admin-display.php:2 54133 #: admin/class-crowdaa-sync-admin-display.php:262 110 134 msgid "You are successfully logged in" 111 135 msgstr "Vous êtes connecté!" 112 136 113 #: admin/class-crowdaa-sync-admin-display.php:2 65137 #: admin/class-crowdaa-sync-admin-display.php:273 114 138 msgid "Please, provide all user data" 115 139 msgstr "Merci de remplir tous les champs demandés" 116 140 117 #: admin/class-crowdaa-sync-api.php:184 admin/class-crowdaa-sync-api.php:3 36118 #: admin/class-crowdaa-sync-api.php: 398 admin/class-crowdaa-sync-api.php:466141 #: admin/class-crowdaa-sync-api.php:184 admin/class-crowdaa-sync-api.php:341 142 #: admin/class-crowdaa-sync-api.php:403 admin/class-crowdaa-sync-api.php:471 119 143 msgid "Not connected to the API" 120 144 msgstr "Non connecté" 121 145 122 #: admin/class-crowdaa-sync-api.php:195 admin/class-crowdaa-sync-api.php:4 78146 #: admin/class-crowdaa-sync-api.php:195 admin/class-crowdaa-sync-api.php:483 123 147 msgid "Cannot sync article without any image or video!" 124 148 msgstr "Impossible de synchroniser un article sans image ou vidéo!" 125 149 126 #: admin/class-crowdaa-sync-api.php:206 admin/class-crowdaa-sync-api.php:4 89150 #: admin/class-crowdaa-sync-api.php:206 admin/class-crowdaa-sync-api.php:494 127 151 msgid "Without title" 128 152 msgstr "Sans titre" 129 153 130 #: admin/class-crowdaa-sync-api.php:213 admin/class-crowdaa-sync-api.php: 495154 #: admin/class-crowdaa-sync-api.php:213 admin/class-crowdaa-sync-api.php:500 131 155 msgid "Without content" 132 156 msgstr "Sans contenu" … … 140 164 msgstr "" 141 165 142 #: admin/class-crowdaa-sync-api.php:27 0 admin/class-crowdaa-sync-api.php:441166 #: admin/class-crowdaa-sync-api.php:274 admin/class-crowdaa-sync-api.php:446 143 167 msgid "Post publish error : " 144 168 msgstr "" 145 169 146 #: admin/class-crowdaa-sync-api.php:34 0170 #: admin/class-crowdaa-sync-api.php:345 147 171 msgid "Unable to create article without Category" 148 172 msgstr "" 149 173 150 #: admin/class-crowdaa-sync-api.php:34 4 admin/class-crowdaa-sync-api.php:406174 #: admin/class-crowdaa-sync-api.php:349 admin/class-crowdaa-sync-api.php:411 151 175 msgid "Cannot sync article without any image and video!" 152 176 msgstr "" 153 177 154 #: admin/class-crowdaa-sync-api.php:3 48 admin/class-crowdaa-sync-api.php:410178 #: admin/class-crowdaa-sync-api.php:353 admin/class-crowdaa-sync-api.php:415 155 179 msgid "Cannot sync article without any title or content!" 156 180 msgstr "" 157 181 158 #: admin/class-crowdaa-sync-api.php:36 2182 #: admin/class-crowdaa-sync-api.php:367 159 183 #, php-format 160 184 msgid "Custom article creation error, query response : %s" 161 185 msgstr "" 162 186 163 #: admin/class-crowdaa-sync-api.php:3 65187 #: admin/class-crowdaa-sync-api.php:370 164 188 #, php-format 165 189 msgid "Custom article creation error, response : %s" 166 190 msgstr "" 167 191 168 #: admin/class-crowdaa-sync-api.php:3 68192 #: admin/class-crowdaa-sync-api.php:373 169 193 #, php-format 170 194 msgid "Custom article creation error, API response : %s" 171 195 msgstr "" 172 196 173 #: admin/class-crowdaa-sync-api.php:3 79 admin/class-crowdaa-sync-api.php:557197 #: admin/class-crowdaa-sync-api.php:384 admin/class-crowdaa-sync-api.php:566 174 198 msgid "Post first publish error : " 175 199 msgstr "" 176 200 177 #: admin/class-crowdaa-sync-api.php:40 2201 #: admin/class-crowdaa-sync-api.php:407 178 202 msgid "Unable to update article without Category" 179 203 msgstr "" 180 204 181 #: admin/class-crowdaa-sync-api.php:42 4205 #: admin/class-crowdaa-sync-api.php:429 182 206 #, php-format 183 207 msgid "Custom article update error, query response : %s" 184 208 msgstr "" 185 209 186 #: admin/class-crowdaa-sync-api.php:4 27210 #: admin/class-crowdaa-sync-api.php:432 187 211 #, php-format 188 212 msgid "Custom article update error, response : %s" 189 213 msgstr "" 190 214 191 #: admin/class-crowdaa-sync-api.php:43 0215 #: admin/class-crowdaa-sync-api.php:435 192 216 #, php-format 193 217 msgid "Custom article update error, API response : %s" 194 218 msgstr "" 195 219 196 #: admin/class-crowdaa-sync-api.php:46 1220 #: admin/class-crowdaa-sync-api.php:466 197 221 msgid "Unable to sync article without Category or Media in Gallery" 198 222 msgstr "" 199 223 200 #: admin/class-crowdaa-sync-api.php:53 3224 #: admin/class-crowdaa-sync-api.php:538 201 225 #, php-format 202 226 msgid "Post creation error for wp post %d, query response : %s" 203 227 msgstr "" 204 228 205 #: admin/class-crowdaa-sync-api.php:5 36229 #: admin/class-crowdaa-sync-api.php:541 206 230 #, php-format 207 231 msgid "Post creation error for wp post %d, response : %s" 208 232 msgstr "" 209 233 210 #: admin/class-crowdaa-sync-api.php:54 0234 #: admin/class-crowdaa-sync-api.php:545 211 235 #, php-format 212 236 msgid "Post creation error for wp post %d, API response : %s" 213 237 msgstr "" 214 238 215 #: admin/class-crowdaa-sync-api.php: 587239 #: admin/class-crowdaa-sync-api.php:600 216 240 msgid "Default article image not set" 217 241 msgstr "L'image par défaut n'est pas définie" 218 242 219 #: admin/class-crowdaa-sync-api.php:6 07243 #: admin/class-crowdaa-sync-api.php:620 220 244 msgid "Missing featured image on post, skipping" 221 245 msgstr "" 222 246 223 #: admin/class-crowdaa-sync-api.php:6 11 admin/class-crowdaa-sync-api.php:672247 #: admin/class-crowdaa-sync-api.php:624 admin/class-crowdaa-sync-api.php:685 224 248 msgid "Image synchronization error : " 225 249 msgstr "" 226 250 227 #: admin/class-crowdaa-sync-api.php:6 67251 #: admin/class-crowdaa-sync-api.php:680 228 252 msgid "Missing gallery image/video on post, skipping" 229 253 msgstr "" 230 254 231 #: admin/class-crowdaa-sync-api.php: 697255 #: admin/class-crowdaa-sync-api.php:710 232 256 msgid "No picture could be synchronized for post " 233 257 msgstr "" 234 258 235 #: admin/class-crowdaa-sync-api.php:7 43259 #: admin/class-crowdaa-sync-api.php:756 236 260 msgid "Not logged in" 237 261 msgstr "Non connecté" 238 262 239 #: admin/class-crowdaa-sync-api.php:9 08263 #: admin/class-crowdaa-sync-api.php:921 240 264 msgid "Query error during badge creation : " 241 265 msgstr "" 242 266 243 #: admin/class-crowdaa-sync-api.php:9 12267 #: admin/class-crowdaa-sync-api.php:925 244 268 msgid "API error during badge creation : " 245 269 msgstr "" 246 270 247 #: admin/class-crowdaa-sync-api.php:9 42271 #: admin/class-crowdaa-sync-api.php:955 248 272 msgid "Query error during badge update : " 249 273 msgstr "" 250 274 251 #: admin/class-crowdaa-sync-api.php:9 46275 #: admin/class-crowdaa-sync-api.php:959 252 276 msgid "API error during badge update : " 253 277 msgstr "" 254 278 255 #: admin/class-crowdaa-sync-api.php:9 66279 #: admin/class-crowdaa-sync-api.php:979 256 280 msgid "Query error during badge delete : " 257 281 msgstr "" 258 282 259 #: admin/class-crowdaa-sync-api.php:9 70283 #: admin/class-crowdaa-sync-api.php:983 260 284 msgid "API error during badge delete : " 261 285 msgstr "" 262 286 263 #: admin/class-crowdaa-sync-api.php:10 00287 #: admin/class-crowdaa-sync-api.php:1013 264 288 msgid "Errors when uploading category image for " 265 289 msgstr "" 266 290 267 #: admin/class-crowdaa-sync-api.php:10 61291 #: admin/class-crowdaa-sync-api.php:1074 268 292 msgid "Query error during category creation : " 269 293 msgstr "" 270 294 271 #: admin/class-crowdaa-sync-api.php:10 65295 #: admin/class-crowdaa-sync-api.php:1078 272 296 msgid "API error during category creation : " 273 297 msgstr "" 274 298 275 #: admin/class-crowdaa-sync-api.php:11 19299 #: admin/class-crowdaa-sync-api.php:1132 276 300 msgid "Query error during category update : " 277 301 msgstr "" 278 302 279 #: admin/class-crowdaa-sync-api.php:11 23303 #: admin/class-crowdaa-sync-api.php:1136 280 304 msgid "API error during category update : " 281 305 msgstr "" 282 306 283 #: admin/class-crowdaa-sync-api.php:11 58307 #: admin/class-crowdaa-sync-api.php:1171 284 308 msgid "Query error during category delete : " 285 309 msgstr "" 286 310 287 #: admin/class-crowdaa-sync-api.php:11 62311 #: admin/class-crowdaa-sync-api.php:1175 288 312 msgid "API error during category delete : " 289 313 msgstr "" … … 457 481 #: admin/class-crowdaa-sync-wp-hooks.php:95 458 482 msgid "Event category" 459 msgstr " "483 msgstr "Catégorie d'événements" 460 484 461 485 #: admin/class-crowdaa-sync-wp-hooks.php:83 … … 465 489 "dates)" 466 490 msgstr "" 491 "Si cette catégorie contient des événements (posts avec une date de début et " 492 "de fin d'événement)" 467 493 468 494 #: admin/class-crowdaa-sync-wp-hooks.php:152 … … 590 616 msgstr "Plugin de permissions utilisé" 591 617 618 #: admin/partials/crowdaa-sync-admin-display.php:200 619 msgid "Save parameters" 620 msgstr "Enregistrer les paramètres" 621 592 622 #: admin/partials/crowdaa-sync-admin-display.php:206 593 623 msgid "Add default picture to the Gallery" 594 624 msgstr "Ajouter une image par défaut" 595 625 626 #: admin/partials/crowdaa-sync-admin-display.php:223 627 msgid "Save picture" 628 msgstr "Enregistrer l'image" 629 596 630 #: admin/partials/crowdaa-sync-admin-display.php:231 597 631 msgid "Set categories to synchronize" … … 631 665 msgstr "" 632 666 667 #: admin/partials/crowdaa-sync-admin-display.php:277 668 msgid "Save mode & categories" 669 msgstr "Enregistrer le mode et les catégories" 670 633 671 #: admin/partials/crowdaa-sync-admin-display.php:285 634 672 msgid "Set feed (front-page) categories" … … 645 683 "principale." 646 684 685 #: admin/partials/crowdaa-sync-admin-display.php:325 686 msgid "Save feed categories" 687 msgstr "Enregistrer les catégories du feed" 688 647 689 #: admin/partials/crowdaa-sync-admin-display.php:334 648 690 msgid "Synchronization" -
crowdaa-sync/trunk/CHANGELOG
r3218183 r3229463 8 8 ## [Unreleased] 9 9 10 ## [1.10.8] - 2025-01-07 11 12 ### Changed 13 14 - Preventing Crowdaa API post deletion when WP>API sync is not enabled 15 16 ## [1.10.7] - 2025-01-03 17 18 ### Changed 19 20 - Fixed order of synchronization steps to remove elements before adding others, to avoid conflicts 10 ## [2.0.1] - 2025-01-27 11 12 ### Changed 13 14 - Added missing translations 15 - Now removing items first before adding new ones (categories, badges) to avoid duplicate issues 16 - Fixed an issue with articles unpublishing from WP to the API 17 - Preventing API posts deletion when deleting from WP when the WP>API sync is not enabled 18 19 ## [2.0.0] - 2024-12-13 20 21 This is marked as a major release beacause it will force a full re-synchronization of all articles. There are no breaking changes other than that. 22 23 ### Changed 24 25 - Reworked the synchronization process to use the update date from the API instead of the publication dates. It allows to : 26 - Synchronize unpublished articles and articles published at a future date both ways 21 27 22 28 ## [1.10.6] - 2024-12-04 -
crowdaa-sync/trunk/README.txt
r3218183 r3229463 6 6 Requires PHP: 7.3 7 7 Tested up to: 5.9 8 Stable tag: 1.10.88 Stable tag: 2.0.1 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
crowdaa-sync/trunk/admin/class-crowdaa-sync-add-info-api.php
r3216233 r3229463 279 279 ]; 280 280 } else if ( 281 $synced_by_wp_id[$id]->permission_hash !== $permission->hash && 281 ( 282 $synced_by_wp_id[$id]->permission_hash !== $permission->hash || 283 $sync_db->get_version() !== $synced_by_wp_id[$id]->sync_version 284 ) && 282 285 isset($badges_by_id[$synced_by_wp_id[$id]->api_id]) 283 286 ) { … … 315 318 ]; 316 319 } else if ( 317 $synced_by_api_id[$id]->badge_hash !== $badge->hash && 320 ( 321 $synced_by_api_id[$id]->badge_hash !== $badge->hash || 322 $sync_db->get_version() !== $synced_by_api_id[$id]->sync_version 323 ) && 318 324 isset($permissions_by_id[$synced_by_api_id[$id]->wp_id]) 319 325 ) { … … 365 371 $categories_by_id = []; 366 372 $sync_api = new Crowdaa_Sync_API(); 367 $sync_db = new Crowdaa_Sync_Syncdb('categories');373 $sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 368 374 $synced = $sync_db->get_synced_entries(); 369 375 $all_categories = $sync_api->get_categories(); … … 532 538 ]; 533 539 } else if ( 534 $synced_by_wp_id[$id]->term_hash !== $term->hash && 540 ( 541 $synced_by_wp_id[$id]->term_hash !== $term->hash || 542 $sync_db->get_version() !== $synced_by_wp_id[$id]->sync_version 543 ) && 535 544 isset($categories_by_id[$synced_by_wp_id[$id]->api_id]) 536 545 ) { … … 578 587 ]; 579 588 } else if ( 580 $synced_by_api_id[$id]->category_hash !== $category->hash && 589 ( 590 $synced_by_api_id[$id]->category_hash !== $category->hash || 591 $sync_db->get_version() !== $synced_by_api_id[$id]->sync_version 592 ) && 581 593 isset($terms_by_id[$synced_by_api_id[$id]->wp_id]) 582 594 ) { … … 648 660 'start' => '0', 649 661 'limit' => $fetch_batch_count, 662 'sortBy' => 'updatedAt', 650 663 'getAuthors' => 'false', 651 664 'getDrafts' => 'false', 652 665 'getOrphansArticles' => 'false', 653 666 'getPictures' => 'false', 654 'onlyPublished' => ' true',667 'onlyPublished' => 'false', 655 668 'showHiddenOnFeed' => 'true', 656 669 'showWithHiddenCategories' => 'false', … … 668 681 669 682 foreach ($api_posts->articles as $api_data) { 670 $update_date_unix = strtotime($api_data-> publicationDate);683 $update_date_unix = strtotime($api_data->updatedAt); 671 684 if ($update_date_unix > $oldest_api_post) { 672 685 $oldest_api_post = $update_date_unix; … … 690 703 $posts_table.post_modified_gmt >= %s AND 691 704 $posts_table.post_type = %s AND 692 $posts_table.post_status = %s705 $posts_table.post_status IN (%s, %s, %s) 693 706 ORDER BY $posts_table.post_modified_gmt ASC 694 707 LIMIT 0, %d", … … 696 709 'post', 697 710 'publish', 711 'future', 712 'draft', 698 713 $fetch_batch_count 699 714 ); … … 733 748 foreach ($all_api_posts as $api_post) { 734 749 $api_post_id = $api_post['api_id']; 735 if (!array_key_exists($api_post_id, $all_wp_posts)) { 750 if (array_key_exists($api_post_id, $all_wp_posts)) { 751 $wp_post = $all_wp_posts[$api_post_id]; 752 } else { 736 753 $raw_wp_post = get_posts([ 737 754 'post_type' => 'post', … … 753 770 $wp_post['post_name'] = $raw_wp_post->post_title; 754 771 $wp_post['update_date_unix'] = strtotime($raw_wp_post->post_modified_gmt); 755 } else {756 $wp_post = $all_wp_posts[$api_post_id]; 757 }758 759 if ($api_post['update_date_unix'] > $wp_post['update_date_unix']) { 760 $last_sync = get_post_meta($wp_post['post_id'], 'crowdaa_last_wp_to_api_sync', true) ?: 0;761 if ($api_post['update_date_unix'] > $last_sync) {772 } 773 774 $last_api_sync = strtotime(get_post_meta($wp_post['post_id'], 'crowdaa_last_api_update', true)); 775 $last_wp_sync = strtotime(get_post_meta($wp_post['post_id'], 'crowdaa_last_wp_update', true)); 776 777 if ($api_post['update_date_unix'] !== $last_api_sync && $wp_post['update_date_unix'] !== $last_wp_sync) { 778 if ($api_post['update_date_unix'] >= $wp_post['update_date_unix']) { 762 779 $result['api_to_wp'][] = $api_post; 780 } else { 781 $result['wp_to_api'][] = $api_post; 763 782 } 764 783 unset($all_wp_posts[$api_post_id]); 765 784 unset($all_api_posts[$api_post_id]); 766 } elseif ($api_post['update_date_unix'] <= $wp_post['update_date_unix']) { 785 } else if ($api_post['update_date_unix'] !== $last_api_sync) { 786 $result['api_to_wp'][] = $api_post; 787 unset($all_wp_posts[$api_post_id]); 788 unset($all_api_posts[$api_post_id]); 789 } else if ($wp_post['update_date_unix'] !== $last_wp_sync) { 790 $result['wp_to_api'][] = $api_post; 791 unset($all_wp_posts[$api_post_id]); 792 unset($all_api_posts[$api_post_id]); 793 } else { 767 794 $need_sync = get_post_meta($wp_post['post_id'], 'crowdaa_need_sync', true); 768 795 $sync_version = get_post_meta($wp_post['post_id'], 'crowdaa_version', true); … … 1062 1089 delete_post_meta($post_id, 'crowdaa_need_sync'); 1063 1090 delete_post_meta($post_id, 'crowdaa_version'); 1064 delete_post_meta($post_id, 'crowdaa_last_wp_to_api_sync'); 1091 delete_post_meta($post_id, 'crowdaa_last_api_update'); 1092 delete_post_meta($post_id, 'crowdaa_last_wp_update'); 1065 1093 delete_post_meta($post_id, 'api_post_id'); 1066 1094 } … … 1151 1179 } 1152 1180 $sync_api = new Crowdaa_Sync_API(); 1153 $sync_db = new Crowdaa_Sync_Syncdb('categories');1181 $sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 1154 1182 $errors = []; 1155 1183 … … 1244 1272 $errors = []; 1245 1273 $sync_api = new Crowdaa_Sync_API(); 1246 $cat_sync_db = new Crowdaa_Sync_Syncdb('categories');1274 $cat_sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 1247 1275 $cat_synced_entries = $cat_sync_db->get_synced_entries(); 1248 1276 … … 1270 1298 1271 1299 // Get category. On multiple categories, pick childless ones first 1272 $child_term = false;1273 1300 $post_terms = get_the_terms($post['post_id'], 'category'); 1274 1301 if (empty($post_terms)) { … … 1370 1397 } 1371 1398 1399 $api_whole_post = $sync_api->get_article($post['api_id']); 1400 $wp_whole_post = get_post($post['post_id']); 1401 1372 1402 update_post_meta($post['post_id'], 'crowdaa_need_sync', 'no'); 1373 1403 update_post_meta($post['post_id'], 'crowdaa_version', Crowdaa_Sync_Versions::get_version()); 1374 update_post_meta($post['post_id'], 'crowdaa_last_wp_to_api_sync', time()); 1404 update_post_meta($post['post_id'], 'crowdaa_last_api_update', $api_whole_post->updatedAt); 1405 update_post_meta($post['post_id'], 'crowdaa_last_wp_update', $wp_whole_post->post_modified_gmt); 1375 1406 } 1376 1407 … … 1398 1429 { 1399 1430 $missing = []; 1400 $result_code = null;1401 $output = null;1402 1431 1403 1432 $default_image = get_option('default_image'); -
crowdaa-sync/trunk/admin/class-crowdaa-sync-add-info-wp.php
r3216233 r3229463 143 143 ) { 144 144 $errors = []; 145 $sync_db = new Crowdaa_Sync_Syncdb('categories');145 $sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 146 146 $categories_sync_to_wp = array_merge($remove_wp, $api_to_wp, $only_api); 147 147 … … 261 261 private function create_wp_post_from_api($api_data) 262 262 { 263 $created_posts = []; 264 $cat_sync_db = new Crowdaa_Sync_Syncdb('categories'); 263 $cat_sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 265 264 266 265 if (isset($api_data->categories) && count($api_data->categories) > 0) { … … 276 275 } 277 276 278 //$publicationTime = self::api_date_to_unix($api_data->publicationDate);277 $publicationTime = self::api_date_to_unix($api_data->publicationDate); 279 278 $post_data = [ 280 279 'post_title' => $api_data->title, 281 280 'post_content' => $api_data->text, 282 //'post_date' => date('Y-m-d H:i:s', $publicationTime),283 //'post_date_gmt' => gmdate('Y-m-d H:i:s', $publicationTime),281 'post_date' => date('Y-m-d H:i:s', $publicationTime), 282 'post_date_gmt' => gmdate('Y-m-d H:i:s', $publicationTime), 284 283 'post_status' => 'publish', 285 284 'post_type' => 'post', 286 285 'post_author' => get_current_user_id(), 287 286 ]; 288 // if ($publicationTime > time()) { 289 // $data['post_status'] = 'future'; 290 // } 287 if ($publicationTime > time()) { 288 $data['post_status'] = 'future'; 289 } else if (!$api_data->isPublished) { 290 $data['post_status'] = 'draft'; 291 } else { 292 $data['post_status'] = 'publish'; 293 } 291 294 292 295 $wp_post_id = wp_insert_post($post_data); … … 315 318 } 316 319 320 $wp_whole_post = get_post($wp_post_id); 317 321 update_post_meta($wp_post_id, 'crowdaa_need_sync', 'no'); 318 322 update_post_meta($wp_post_id, 'crowdaa_version', Crowdaa_Sync_Versions::get_version()); 323 update_post_meta($wp_post_id, 'crowdaa_last_api_update', $api_data->updatedAt); 324 update_post_meta($wp_post_id, 'crowdaa_last_wp_update', $wp_whole_post->post_modified_gmt); 319 325 320 326 Crowdaa_Sync_Logs::log('Created WP post', $wp_post_id); … … 323 329 } 324 330 325 // private static function api_date_to_unix($date) { 326 // $matches = []; 327 // preg_match('/^(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)\.\d+Z/', $date, $matches); 328 // $time = gmmktime( 329 // intval($matches[4], 10), 330 // intval($matches[5], 10), 331 // intval($matches[6], 10), 332 // intval($matches[2], 10), 333 // intval($matches[3], 10), 334 // intval($matches[1], 10), 335 // ); 336 // return ($time); 337 // } 331 private static function api_date_to_unix($date) 332 { 333 $matches = []; 334 preg_match('/^(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)\.\d+Z/', $date, $matches); 335 $time = gmmktime( 336 intval($matches[4], 10), 337 intval($matches[5], 10), 338 intval($matches[6], 10), 339 intval($matches[2], 10), 340 intval($matches[3], 10), 341 intval($matches[1], 10), 342 ); 343 return ($time); 344 } 338 345 339 346 private function update_wp_post_from_api($api_data, $wp_post_id) 340 347 { 341 $created_posts = []; 342 $cat_sync_db = new Crowdaa_Sync_Syncdb('categories'); 348 $cat_sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 343 349 344 350 if (isset($api_data->categories) && count($api_data->categories) > 0) { … … 354 360 } 355 361 356 //$publicationTime = self::api_date_to_unix($api_data->publicationDate);362 $publicationTime = self::api_date_to_unix($api_data->publicationDate); 357 363 $data = [ 358 364 'ID' => $wp_post_id, 359 365 'post_title' => $api_data->title, 360 366 'post_content' => $api_data->text, 361 //'post_date' => date('Y-m-d H:i:s', $publicationTime),362 //'post_date_gmt' => gmdate('Y-m-d H:i:s', $publicationTime),367 'post_date' => date('Y-m-d H:i:s', $publicationTime), 368 'post_date_gmt' => gmdate('Y-m-d H:i:s', $publicationTime), 363 369 ]; 364 // if ($publicationTime > time()) { 365 // $data['post_status'] = 'future'; 366 // } 370 if ($publicationTime > time()) { 371 $data['post_status'] = 'future'; 372 } else if (!$api_data->isPublished) { 373 $data['post_status'] = 'draft'; 374 } else { 375 $data['post_status'] = 'publish'; 376 } 367 377 368 378 wp_set_post_terms($wp_post_id, $terms, 'category'); … … 391 401 } 392 402 403 $wp_whole_post = get_post($wp_post_id); 393 404 update_post_meta($wp_post_id, 'crowdaa_need_sync', 'no'); 394 405 update_post_meta($wp_post_id, 'crowdaa_version', Crowdaa_Sync_Versions::get_version()); 406 update_post_meta($wp_post_id, 'crowdaa_last_api_update', $api_data->updatedAt); 407 update_post_meta($wp_post_id, 'crowdaa_last_wp_update', $wp_whole_post->post_modified_gmt); 395 408 396 409 Crowdaa_Sync_Logs::log('Updated WP post', $wp_post_id, $api_data->_id); … … 497 510 ])); 498 511 } catch (\Throwable $e) { 499 Crowdaa_Sync_Logs::log('Set WP term feed picture error', $e->getMessage());500 512 throw new Crowdaa_Sync_Category_Error(__('Set WP term feed picture error : ', CROWDAA_SYNC_PLUGIN_NAME) . $e->getMessage()); 501 513 } … … 574 586 $fetch_err = $this->get_uploads($feed_pic_url, $feed_pic_name); 575 587 if ($fetch_err) { 576 $errors[] = $fetch_err;588 throw new Crowdaa_Sync_Post_Error(__('Feed image synchronization error (download) : ', CROWDAA_SYNC_PLUGIN_NAME) . $fetch_err); 577 589 } 578 590 } … … 581 593 $attachment_id = $this->set_uploads($wp_post_id, $feed_pic_name, true); 582 594 } catch (\Throwable $e) { 583 Crowdaa_Sync_Logs::log('Set WP post feed picture error', $e->getMessage()); 584 $errors[] = $e->getMessage(); 585 return; 595 throw new Crowdaa_Sync_Post_Error(__('Feed image synchronization error (storage) : ', CROWDAA_SYNC_PLUGIN_NAME) . $e->getMessage()); 586 596 } 587 597 update_post_meta($wp_post_id, 'api_feedpicture_id', serialize([ … … 631 641 $fetch_err = $this->get_uploads($image_url, $image_name); 632 642 if ($fetch_err) { 633 $errors[] = $fetch_err; 634 continue; 643 throw new Crowdaa_Sync_Post_Error(__('Image synchronization error (download) : ', CROWDAA_SYNC_PLUGIN_NAME) . $fetch_err); 635 644 } 636 645 } … … 640 649 $images_map[$image_id] = $attachment_id; 641 650 } catch (\Throwable $e) { 642 Crowdaa_Sync_Logs::log('Set WP post image error', $e->getMessage()); 643 $errors[] = $e->getMessage(); 644 continue; 651 throw new Crowdaa_Sync_Post_Error(__('Image synchronization error (storage) : ', CROWDAA_SYNC_PLUGIN_NAME) . $e->getMessage()); 645 652 } 646 653 } … … 680 687 $convert_error = $this->ffmpeg_video_converter($video->url, $video_name); 681 688 if ($convert_error) { 682 $errors[] = $convert_error; 683 continue; 689 throw new Crowdaa_Sync_Post_Error(__('Video synchronization error (convert) : ', CROWDAA_SYNC_PLUGIN_NAME) . $convert_error); 684 690 } 685 691 } … … 689 695 $videos_map[$video_id] = $attachment_id; 690 696 } catch (\Throwable $e) { 691 Crowdaa_Sync_Logs::log('Set WP post video error', $e->getMessage()); 692 $errors[] = $e->getMessage(); 693 continue; 697 throw new Crowdaa_Sync_Post_Error(__('Video synchronization error (storage) : ', CROWDAA_SYNC_PLUGIN_NAME) . $e->getMessage()); 694 698 } 695 699 } … … 834 838 835 839 try { 836 wp_remote_get($img_url, [840 $ret = wp_remote_get($img_url, [ 837 841 'method' => 'GET', 838 842 'timeout' => 45, … … 841 845 'sslcertificates' => CROWDAA_SYNC_CACERT_PATH, 842 846 ]); 847 848 if (is_wp_error($ret)) { 849 return $ret->get_error_message(); 850 } 843 851 844 852 return (false); -
crowdaa-sync/trunk/admin/class-crowdaa-sync-admin-display.php
r3202416 r3229463 41 41 Crowdaa_Sync_Permissions::reset(); 42 42 43 $sync_db = new Crowdaa_Sync_Syncdb('categories');43 $sync_db = Crowdaa_Sync_Syncdb::instance('categories'); 44 44 $sync_db->reset(); 45 45 -
crowdaa-sync/trunk/admin/class-crowdaa-sync-api.php
r3169735 r3229463 254 254 } 255 255 256 $send_notification = ( 257 get_post_meta($wp_post_id, 'crowdaa_notification_send', true) === 'yes' && 258 get_post_meta($wp_post_id, 'crowdaa_notification_sent', true) !== 'yes' 259 ); 260 $publish_error = $this->publish_post_draft_api( 261 $json->draftId, 262 $api_post_id, 263 $publication_time, 264 $send_notification, 265 (get_post_meta($wp_post_id, 'crowdaa_notification_content', true) ?: null), 266 (get_post_meta($wp_post_id, 'crowdaa_notification_title', true) ?: null), 267 ); 268 if ($publish_error) { 269 Crowdaa_Sync_Logs::log('Article publish error', $api_post_id, $publish_error); 270 throw new Crowdaa_Sync_Post_Error(__('Post publish error : ', CROWDAA_SYNC_PLUGIN_NAME) . $publish_error); 271 } 272 273 if ($send_notification) { 274 update_post_meta($wp_post_id, 'crowdaa_notification_sent', 'yes'); 275 } 276 277 Crowdaa_Sync_Logs::log('Updated API article successfully', $api_post_id, $json->draftId); 278 } 279 } 280 256 $post_status = get_post_status($wp_post_id); 257 if ($post_status === 'draft') { 258 Crowdaa_Sync_Logs::log('Updated API post (draft)', $json->articleId); 259 $this->unpublish_api_article($json->articleId); 260 } else { 261 $send_notification = ( 262 get_post_meta($wp_post_id, 'crowdaa_notification_send', true) === 'yes' && 263 get_post_meta($wp_post_id, 'crowdaa_notification_sent', true) !== 'yes' 264 ); 265 $publish_error = $this->publish_post_draft_api( 266 $json->draftId, 267 $api_post_id, 268 $publication_time, 269 $send_notification, 270 (get_post_meta($wp_post_id, 'crowdaa_notification_content', true) ?: null), 271 (get_post_meta($wp_post_id, 'crowdaa_notification_title', true) ?: null), 272 ); 273 if ($publish_error) { 274 Crowdaa_Sync_Logs::log('Article publish error', $api_post_id, $publish_error); 275 throw new Crowdaa_Sync_Post_Error(__('Post publish error : ', CROWDAA_SYNC_PLUGIN_NAME) . $publish_error); 276 } 277 278 if ($send_notification) { 279 update_post_meta($wp_post_id, 'crowdaa_notification_sent', 'yes'); 280 } 281 282 Crowdaa_Sync_Logs::log('Updated API article successfully', $api_post_id, $json->draftId); 283 } 284 } 285 } 286 287 public function unpublish_api_article($api_post_id) 288 { 289 $url = '/press/articles/' . rawurlencode($api_post_id) . '/unpublish'; 290 $response = $this->http_request('PUT', $url); 291 $err = is_wp_error($response) ? $response->get_error_message() : null; 292 if (!$err) { 293 $body = wp_remote_retrieve_body($response); 294 $json = json_decode($body); 295 } 296 297 if ($err) { 298 Crowdaa_Sync_Logs::log('Unpublish article query error', $api_post_id, $err); 299 return ((object) [ 300 'message' => $err, 301 ]); 302 } 303 304 if (isset($json->message)) { 305 Crowdaa_Sync_Logs::log('Unpublish article error', $json->message); 306 } 307 308 return ($json); 309 } 281 310 282 311 /** … … 541 570 } 542 571 543 $send_notification = ( 544 get_post_meta($wp_post_id, 'crowdaa_notification_send', true) === 'yes' && 545 get_post_meta($wp_post_id, 'crowdaa_notification_sent', true) !== 'yes' 546 ); 547 $publish_error = $this->publish_post_draft_api( 548 $json->draftId, 549 $json->articleId, 550 $publication_time, 551 $send_notification, 552 (get_post_meta($wp_post_id, 'crowdaa_notification_content', true) ?: null), 553 (get_post_meta($wp_post_id, 'crowdaa_notification_title', true) ?: null), 554 ); 555 if ($publish_error) { 556 Crowdaa_Sync_Logs::log('Article first publish error', $json->articleId, $json->draftId, $publish_error); 557 throw new Crowdaa_Sync_Post_Error(__('Post first publish error : ', CROWDAA_SYNC_PLUGIN_NAME) . $publish_error); 558 } 559 560 update_post_meta($wp_post_id, 'api_post_id', $json->articleId); 561 if ($send_notification) { 562 update_post_meta($wp_post_id, 'crowdaa_notification_sent', 'yes'); 563 } 564 Crowdaa_Sync_Logs::log('Created API post', $json->articleId); 572 $post_status = get_post_status($wp_post_id); 573 if ($post_status === 'draft') { 574 Crowdaa_Sync_Logs::log('Updated API post (draft)', $json->articleId); 575 $this->unpublish_api_article($json->articleId); 576 } else { 577 $send_notification = ( 578 get_post_meta($wp_post_id, 'crowdaa_notification_send', true) === 'yes' && 579 get_post_meta($wp_post_id, 'crowdaa_notification_sent', true) !== 'yes' 580 ); 581 $publish_error = $this->publish_post_draft_api( 582 $json->draftId, 583 $json->articleId, 584 $publication_time, 585 $send_notification, 586 (get_post_meta($wp_post_id, 'crowdaa_notification_content', true) ?: null), 587 (get_post_meta($wp_post_id, 'crowdaa_notification_title', true) ?: null), 588 ); 589 if ($publish_error) { 590 Crowdaa_Sync_Logs::log('Article first publish error', $json->articleId, $json->draftId, $publish_error); 591 throw new Crowdaa_Sync_Post_Error(__('Post first publish error : ', CROWDAA_SYNC_PLUGIN_NAME) . $publish_error); 592 } 593 594 update_post_meta($wp_post_id, 'api_post_id', $json->articleId); 595 if ($send_notification) { 596 update_post_meta($wp_post_id, 'crowdaa_notification_sent', 'yes'); 597 } 598 599 Crowdaa_Sync_Logs::log('Created API post', $json->articleId); 600 } 601 602 return $json->articleId; 565 603 } 566 604 } -
crowdaa-sync/trunk/admin/partials/crowdaa-sync-admin-display.php
r3169735 r3229463 198 198 <br /> 199 199 <?php wp_nonce_field('crowdaa_cron_sync_enabled_data', 'crowdaa_cron_sync_enabled'); ?> 200 <?php submit_button( 'Save parameters'); ?>200 <?php submit_button(__('Save parameters', CROWDAA_SYNC_PLUGIN_NAME)); ?> 201 201 </form> 202 202 </div> … … 221 221 <input type="file" required name="file" id="image_file" accept=".jpg, .jpeg, .png" /> 222 222 <?php 223 submit_button( 'Save picture');223 submit_button(__('Save picture', CROWDAA_SYNC_PLUGIN_NAME)); 224 224 ?> 225 225 </form> … … 275 275 <?php wp_nonce_field('crowdaa_set_sync_categories_data', 'crowdaa_set_sync_categories'); ?> 276 276 <?php 277 submit_button( 'Save mode & categories');277 submit_button(__('Save mode & categories', CROWDAA_SYNC_PLUGIN_NAME)); 278 278 ?> 279 279 </form> … … 323 323 <?php wp_nonce_field('crowdaa_set_feed_categories_data', 'crowdaa_set_feed_categories'); ?> 324 324 <?php 325 submit_button( 'Save feed categories');325 submit_button(__('Save feed categories', CROWDAA_SYNC_PLUGIN_NAME)); 326 326 ?> 327 327 </form> -
crowdaa-sync/trunk/crowdaa-sync.php
r3218183 r3229463 14 14 * Plugin URI: 15 15 * Description: Plugin for synchronizing WordPress site and Crowdaa CMS 16 * Version: 1.10.816 * Version: 2.0.1 17 17 * Requires at least: 5.5 18 18 * Requires PHP: 7.2 … … 34 34 * Uses SemVer - https://semver.org 35 35 */ 36 define('CROWDAA_SYNC_VERSION', ' 1.10.8');36 define('CROWDAA_SYNC_VERSION', '2.0.1'); 37 37 define('CROWDAA_SYNC_PLUGIN_DIR', __DIR__); 38 38 define('CROWDAA_SYNC_PLUGIN_NAME', 'crowdaa-sync'); … … 44 44 * Just bump the version, it will handle the rest. 45 45 */ 46 define('CROWDAA_SYNC_META_VERSION', ' 3');46 define('CROWDAA_SYNC_META_VERSION', '4'); 47 47 48 48 $last_version = get_option('crowdaa_last_version', false); -
crowdaa-sync/trunk/includes/class-crowdaa-sync-exception.php
r3149200 r3229463 11 11 */ 12 12 13 class Crowdaa_Sync_Generic_Exception extends Exception 14 { 15 public function __construct($message = 'NO_MESSAGE_GIVEN', ...$extra) 16 { 17 parent::__construct($message); 18 19 $to_log = $message; 20 if ($extra) { 21 foreach ($extra as $item) { 22 if (!is_string($item)) { 23 $to_log .= '|' . print_r($item, true); 24 } else { 25 $to_log .= '|' . $item; 26 } 27 } 28 } 29 30 Crowdaa_Sync_Logs::log((new \ReflectionClass($this))->getShortName(), '__construct() called with', $to_log); 31 } 32 } 33 13 34 /** 14 35 * The base project exception, when a fatal error occurs. … … 21 42 * @author Crowdaa <contact@crowdaa.com> 22 43 */ 23 class Crowdaa_Sync_Error extends Exception 24 { 25 } 44 class Crowdaa_Sync_Error extends Crowdaa_Sync_Generic_Exception {} 26 45 27 46 /** … … 33 52 * @author Crowdaa <contact@crowdaa.com> 34 53 */ 35 class Crowdaa_Sync_Badge_Error extends Exception 36 { 37 } 54 class Crowdaa_Sync_Badge_Error extends Crowdaa_Sync_Generic_Exception {} 38 55 39 56 /** … … 45 62 * @author Crowdaa <contact@crowdaa.com> 46 63 */ 47 class Crowdaa_Sync_Category_Error extends Exception 48 { 49 } 64 class Crowdaa_Sync_Category_Error extends Crowdaa_Sync_Generic_Exception {} 50 65 51 66 /** … … 57 72 * @author Crowdaa <contact@crowdaa.com> 58 73 */ 59 class Crowdaa_Sync_Post_Error extends Exception 60 { 61 } 74 class Crowdaa_Sync_Post_Error extends Crowdaa_Sync_Generic_Exception {} 62 75 63 76 /** … … 69 82 * @author Crowdaa <contact@crowdaa.com> 70 83 */ 71 class Crowdaa_Sync_Post_Skip_Error extends Crowdaa_Sync_Post_Error 72 { 73 } 84 class Crowdaa_Sync_Post_Skip_Error extends Crowdaa_Sync_Post_Error {} 74 85 75 86 /** … … 81 92 * @author Crowdaa <contact@crowdaa.com> 82 93 */ 83 class Crowdaa_Sync_Timeout_Error extends Exception 84 { 85 } 94 class Crowdaa_Sync_Timeout_Error extends Crowdaa_Sync_Generic_Exception {} -
crowdaa-sync/trunk/includes/class-crowdaa-sync-permissions.php
r3179247 r3229463 129 129 public static function sync_db() 130 130 { 131 return ( new Crowdaa_Sync_Syncdb('user_badges'));131 return (Crowdaa_Sync_Syncdb::instance('user_badges')); 132 132 } 133 133 -
crowdaa-sync/trunk/includes/class-crowdaa-sync-syncdb.php
r3195042 r3229463 16 16 private static $loaded = array(); 17 17 18 public static function instance($tableName) 19 { 20 switch ($tableName) { 21 case 'categories': 22 case 'user_badges': 23 return new self($tableName, CROWDAA_SYNC_META_VERSION); 24 break; 25 default: 26 return new self($tableName); 27 break; 28 } 29 } 30 18 31 /** 19 32 * Initialize the database. … … 49 62 } 50 63 64 public function get_version() 65 { 66 return $this->version; 67 } 68 51 69 /** 52 70 * Returns an assoc array of synced elements, with the provided fields (null means all) … … 151 169 if (isset($v->sync_data)) { 152 170 $v->sync_data = unserialize($v->sync_data); 171 } else { 172 $v->sync_data = []; 153 173 } 154 174 } … … 266 286 return (array_pop($result)); 267 287 } 288 289 /** 290 * Delete an entry with the specified internal ID. 291 */ 292 public function delete_entry_with_id($id) 293 { 294 global $wpdb; 295 296 list($whereStr, $whereArg) = self::prepare_wherein($id, 'id'); 297 298 $wpdb->get_results($wpdb->prepare("DELETE FROM `$this->tableName` WHERE $whereStr", ...$whereArg), OBJECT_K); 299 } 268 300 } -
crowdaa-sync/trunk/languages/crowdaa-sync-fr_FR.po
r3169735 r3229463 3 3 "Project-Id-Version: WpCrowdaaSyncTranslations\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 2024-1 0-15 17:46+0400\n"6 "PO-Revision-Date: 2024-1 0-15 17:47+0400\n"5 "POT-Creation-Date: 2024-12-16 10:58+0400\n" 6 "PO-Revision-Date: 2024-12-16 11:05+0400\n" 7 7 "Last-Translator: \n" 8 8 "Language-Team: Français\n" … … 12 12 "Content-Transfer-Encoding: 8bit\n" 13 13 "Plural-Forms: nplurals=2; plural=(n > 1);\n" 14 "X-Generator: Poedit 3. 2.2\n"14 "X-Generator: Poedit 3.4.2\n" 15 15 "X-Poedit-Basepath: ..\n" 16 16 "X-Poedit-KeywordsList: __;_e;esc_html_e;esc_attr_e\n" … … 24 24 25 25 #: admin/class-crowdaa-sync-add-info-api.php:217 26 #: admin/class-crowdaa-sync-add-info-api.php:6 3026 #: admin/class-crowdaa-sync-add-info-api.php:643 27 27 msgid "User is not connected" 28 28 msgstr "Utilisateur non connecté" 29 29 30 30 #: admin/class-crowdaa-sync-add-info-api.php:245 31 #: admin/class-crowdaa-sync-add-info-api.php:37 232 #: admin/class-crowdaa-sync-add-info-api.php:6 6031 #: admin/class-crowdaa-sync-add-info-api.php:378 32 #: admin/class-crowdaa-sync-add-info-api.php:674 33 33 msgid "API query error : " 34 34 msgstr "Erreur de requête d'API :" 35 35 36 #: admin/class-crowdaa-sync-add-info-api.php:8 2736 #: admin/class-crowdaa-sync-add-info-api.php:855 37 37 msgid "The synchronization cannot be done, missing dependencies : " 38 38 msgstr "La synchronisation ne peut se faire, dépendances manquantes :" 39 39 40 #: admin/class-crowdaa-sync-add-info-api.php:8 3240 #: admin/class-crowdaa-sync-add-info-api.php:860 41 41 msgid "Cannot run : a synchronization is already running" 42 42 msgstr "Une synchronisation est déjà en cours, merci de réessayer plus tard" 43 43 44 #: admin/class-crowdaa-sync-add-info-api.php:9 6644 #: admin/class-crowdaa-sync-add-info-api.php:994 45 45 msgid "Some errors happened during synchronization : " 46 46 msgstr "Des erreurs ont eu lieu pendant la synchronisation :" 47 47 48 #: admin/class-crowdaa-sync-add-info-api.php:9 6948 #: admin/class-crowdaa-sync-add-info-api.php:997 49 49 msgid "All data synced successfully" 50 50 msgstr "Données synchronisées avec succès" 51 51 52 #: admin/class-crowdaa-sync-add-info-api.php: 97452 #: admin/class-crowdaa-sync-add-info-api.php:1002 53 53 msgid "" 54 54 "The synchronization process timed out, please retry it until it succeeds." … … 57 57 "relancer jusqu'à ce que qu'elle se termine entièrement." 58 58 59 #: admin/class-crowdaa-sync-add-info-api.php: 97659 #: admin/class-crowdaa-sync-add-info-api.php:1004 60 60 msgid "Uncaught Post synchronization error : " 61 msgstr " "62 63 #: admin/class-crowdaa-sync-add-info-api.php: 97861 msgstr "Erreur non rattrapée de synchronsation de post : " 62 63 #: admin/class-crowdaa-sync-add-info-api.php:1006 64 64 msgid "Category synchronization error : " 65 msgstr " "66 67 #: admin/class-crowdaa-sync-add-info-api.php: 98065 msgstr "Erreur de synchronisation de catégorie : " 66 67 #: admin/class-crowdaa-sync-add-info-api.php:1008 68 68 msgid "Badge synchronization error : " 69 msgstr " "70 71 #: admin/class-crowdaa-sync-add-info-api.php: 98269 msgstr "Erreur de synchronisation de badge : " 70 71 #: admin/class-crowdaa-sync-add-info-api.php:1010 72 72 msgid "Fatal synchronization error : " 73 msgstr " "74 75 #: admin/class-crowdaa-sync-add-info-api.php: 98473 msgstr "Erreur de synchronisation fatale : " 74 75 #: admin/class-crowdaa-sync-add-info-api.php:1012 76 76 msgid "Unknown synchronzation error : " 77 msgstr " "78 79 #: admin/class-crowdaa-sync-add-info-wp.php: 49077 msgstr "Erreur de synchronisation inconnue : " 78 79 #: admin/class-crowdaa-sync-add-info-wp.php:501 80 80 msgid "Errors when downloading term image for " 81 msgstr " "82 83 #: admin/class-crowdaa-sync-add-info-wp.php:5 0281 msgstr "Erreur de téléchargement de l'image de catégorie pour " 82 83 #: admin/class-crowdaa-sync-add-info-wp.php:512 84 84 msgid "Set WP term feed picture error : " 85 msgstr "" 86 87 #: admin/class-crowdaa-sync-add-info-wp.php:869 85 msgstr "Erreur de définition de l'image du feed :" 86 87 #: admin/class-crowdaa-sync-add-info-wp.php:588 88 msgid "Feed image synchronization error (download) : " 89 msgstr "Erreur de synchronisation de l'image du feed (téléchargement) :" 90 91 #: admin/class-crowdaa-sync-add-info-wp.php:595 92 msgid "Feed image synchronization error (storage) : " 93 msgstr "Erreur de synchronisation de l'image du feed (stockage) :" 94 95 #: admin/class-crowdaa-sync-add-info-wp.php:643 96 msgid "Image synchronization error (download) : " 97 msgstr "Erreur de synchronisation d'image (téléchargement) :" 98 99 #: admin/class-crowdaa-sync-add-info-wp.php:651 100 msgid "Image synchronization error (storage) : " 101 msgstr "Erreur de synchronisation d'image (stockage) :" 102 103 #: admin/class-crowdaa-sync-add-info-wp.php:689 104 msgid "Video synchronization error (convert) : " 105 msgstr "Erreur de synchronisation de vidéo (conversion) :" 106 107 #: admin/class-crowdaa-sync-add-info-wp.php:697 108 msgid "Video synchronization error (storage) : " 109 msgstr "Erreur de synchronisation de vidéo (stockage) :" 110 111 #: admin/class-crowdaa-sync-add-info-wp.php:875 88 112 msgid "" 89 113 "You don't have ffmpeg installed on your server to download videos, please " … … 94 118 "hébergeur" 95 119 96 #: admin/class-crowdaa-sync-admin-display.php: 19797 #: admin/class-crowdaa-sync-admin-display.php:2 08120 #: admin/class-crowdaa-sync-admin-display.php:205 121 #: admin/class-crowdaa-sync-admin-display.php:216 98 122 msgid "Failed to get data. Please try again later" 99 123 msgstr "Communication réseau impossible, merci de réessayer ultérieurement" 100 124 101 #: admin/class-crowdaa-sync-admin-display.php:2 19125 #: admin/class-crowdaa-sync-admin-display.php:227 102 126 msgid "Data is incorrect please double-check and try again" 103 127 msgstr "Les données sont incorrectes, merci de vérifier les paramètres fournis" 104 128 105 #: admin/class-crowdaa-sync-admin-display.php:2 47129 #: admin/class-crowdaa-sync-admin-display.php:255 106 130 msgid "Failed to complete login initialization process" 107 131 msgstr "Échec d'initialisation du plugin, merci de réessayer" 108 132 109 #: admin/class-crowdaa-sync-admin-display.php:2 54133 #: admin/class-crowdaa-sync-admin-display.php:262 110 134 msgid "You are successfully logged in" 111 135 msgstr "Vous êtes connecté!" 112 136 113 #: admin/class-crowdaa-sync-admin-display.php:2 65137 #: admin/class-crowdaa-sync-admin-display.php:273 114 138 msgid "Please, provide all user data" 115 139 msgstr "Merci de remplir tous les champs demandés" 116 140 117 #: admin/class-crowdaa-sync-api.php:184 admin/class-crowdaa-sync-api.php:3 36118 #: admin/class-crowdaa-sync-api.php: 398 admin/class-crowdaa-sync-api.php:466141 #: admin/class-crowdaa-sync-api.php:184 admin/class-crowdaa-sync-api.php:341 142 #: admin/class-crowdaa-sync-api.php:403 admin/class-crowdaa-sync-api.php:471 119 143 msgid "Not connected to the API" 120 144 msgstr "Non connecté" 121 145 122 #: admin/class-crowdaa-sync-api.php:195 admin/class-crowdaa-sync-api.php:4 78146 #: admin/class-crowdaa-sync-api.php:195 admin/class-crowdaa-sync-api.php:483 123 147 msgid "Cannot sync article without any image or video!" 124 148 msgstr "Impossible de synchroniser un article sans image ou vidéo!" 125 149 126 #: admin/class-crowdaa-sync-api.php:206 admin/class-crowdaa-sync-api.php:4 89150 #: admin/class-crowdaa-sync-api.php:206 admin/class-crowdaa-sync-api.php:494 127 151 msgid "Without title" 128 152 msgstr "Sans titre" 129 153 130 #: admin/class-crowdaa-sync-api.php:213 admin/class-crowdaa-sync-api.php: 495154 #: admin/class-crowdaa-sync-api.php:213 admin/class-crowdaa-sync-api.php:500 131 155 msgid "Without content" 132 156 msgstr "Sans contenu" … … 140 164 msgstr "" 141 165 142 #: admin/class-crowdaa-sync-api.php:27 0 admin/class-crowdaa-sync-api.php:441166 #: admin/class-crowdaa-sync-api.php:274 admin/class-crowdaa-sync-api.php:446 143 167 msgid "Post publish error : " 144 168 msgstr "" 145 169 146 #: admin/class-crowdaa-sync-api.php:34 0170 #: admin/class-crowdaa-sync-api.php:345 147 171 msgid "Unable to create article without Category" 148 172 msgstr "" 149 173 150 #: admin/class-crowdaa-sync-api.php:34 4 admin/class-crowdaa-sync-api.php:406174 #: admin/class-crowdaa-sync-api.php:349 admin/class-crowdaa-sync-api.php:411 151 175 msgid "Cannot sync article without any image and video!" 152 176 msgstr "" 153 177 154 #: admin/class-crowdaa-sync-api.php:3 48 admin/class-crowdaa-sync-api.php:410178 #: admin/class-crowdaa-sync-api.php:353 admin/class-crowdaa-sync-api.php:415 155 179 msgid "Cannot sync article without any title or content!" 156 180 msgstr "" 157 181 158 #: admin/class-crowdaa-sync-api.php:36 2182 #: admin/class-crowdaa-sync-api.php:367 159 183 #, php-format 160 184 msgid "Custom article creation error, query response : %s" 161 185 msgstr "" 162 186 163 #: admin/class-crowdaa-sync-api.php:3 65187 #: admin/class-crowdaa-sync-api.php:370 164 188 #, php-format 165 189 msgid "Custom article creation error, response : %s" 166 190 msgstr "" 167 191 168 #: admin/class-crowdaa-sync-api.php:3 68192 #: admin/class-crowdaa-sync-api.php:373 169 193 #, php-format 170 194 msgid "Custom article creation error, API response : %s" 171 195 msgstr "" 172 196 173 #: admin/class-crowdaa-sync-api.php:3 79 admin/class-crowdaa-sync-api.php:557197 #: admin/class-crowdaa-sync-api.php:384 admin/class-crowdaa-sync-api.php:566 174 198 msgid "Post first publish error : " 175 199 msgstr "" 176 200 177 #: admin/class-crowdaa-sync-api.php:40 2201 #: admin/class-crowdaa-sync-api.php:407 178 202 msgid "Unable to update article without Category" 179 203 msgstr "" 180 204 181 #: admin/class-crowdaa-sync-api.php:42 4205 #: admin/class-crowdaa-sync-api.php:429 182 206 #, php-format 183 207 msgid "Custom article update error, query response : %s" 184 208 msgstr "" 185 209 186 #: admin/class-crowdaa-sync-api.php:4 27210 #: admin/class-crowdaa-sync-api.php:432 187 211 #, php-format 188 212 msgid "Custom article update error, response : %s" 189 213 msgstr "" 190 214 191 #: admin/class-crowdaa-sync-api.php:43 0215 #: admin/class-crowdaa-sync-api.php:435 192 216 #, php-format 193 217 msgid "Custom article update error, API response : %s" 194 218 msgstr "" 195 219 196 #: admin/class-crowdaa-sync-api.php:46 1220 #: admin/class-crowdaa-sync-api.php:466 197 221 msgid "Unable to sync article without Category or Media in Gallery" 198 222 msgstr "" 199 223 200 #: admin/class-crowdaa-sync-api.php:53 3224 #: admin/class-crowdaa-sync-api.php:538 201 225 #, php-format 202 226 msgid "Post creation error for wp post %d, query response : %s" 203 227 msgstr "" 204 228 205 #: admin/class-crowdaa-sync-api.php:5 36229 #: admin/class-crowdaa-sync-api.php:541 206 230 #, php-format 207 231 msgid "Post creation error for wp post %d, response : %s" 208 232 msgstr "" 209 233 210 #: admin/class-crowdaa-sync-api.php:54 0234 #: admin/class-crowdaa-sync-api.php:545 211 235 #, php-format 212 236 msgid "Post creation error for wp post %d, API response : %s" 213 237 msgstr "" 214 238 215 #: admin/class-crowdaa-sync-api.php: 587239 #: admin/class-crowdaa-sync-api.php:600 216 240 msgid "Default article image not set" 217 241 msgstr "L'image par défaut n'est pas définie" 218 242 219 #: admin/class-crowdaa-sync-api.php:6 07243 #: admin/class-crowdaa-sync-api.php:620 220 244 msgid "Missing featured image on post, skipping" 221 245 msgstr "" 222 246 223 #: admin/class-crowdaa-sync-api.php:6 11 admin/class-crowdaa-sync-api.php:672247 #: admin/class-crowdaa-sync-api.php:624 admin/class-crowdaa-sync-api.php:685 224 248 msgid "Image synchronization error : " 225 249 msgstr "" 226 250 227 #: admin/class-crowdaa-sync-api.php:6 67251 #: admin/class-crowdaa-sync-api.php:680 228 252 msgid "Missing gallery image/video on post, skipping" 229 253 msgstr "" 230 254 231 #: admin/class-crowdaa-sync-api.php: 697255 #: admin/class-crowdaa-sync-api.php:710 232 256 msgid "No picture could be synchronized for post " 233 257 msgstr "" 234 258 235 #: admin/class-crowdaa-sync-api.php:7 43259 #: admin/class-crowdaa-sync-api.php:756 236 260 msgid "Not logged in" 237 261 msgstr "Non connecté" 238 262 239 #: admin/class-crowdaa-sync-api.php:9 08263 #: admin/class-crowdaa-sync-api.php:921 240 264 msgid "Query error during badge creation : " 241 265 msgstr "" 242 266 243 #: admin/class-crowdaa-sync-api.php:9 12267 #: admin/class-crowdaa-sync-api.php:925 244 268 msgid "API error during badge creation : " 245 269 msgstr "" 246 270 247 #: admin/class-crowdaa-sync-api.php:9 42271 #: admin/class-crowdaa-sync-api.php:955 248 272 msgid "Query error during badge update : " 249 273 msgstr "" 250 274 251 #: admin/class-crowdaa-sync-api.php:9 46275 #: admin/class-crowdaa-sync-api.php:959 252 276 msgid "API error during badge update : " 253 277 msgstr "" 254 278 255 #: admin/class-crowdaa-sync-api.php:9 66279 #: admin/class-crowdaa-sync-api.php:979 256 280 msgid "Query error during badge delete : " 257 281 msgstr "" 258 282 259 #: admin/class-crowdaa-sync-api.php:9 70283 #: admin/class-crowdaa-sync-api.php:983 260 284 msgid "API error during badge delete : " 261 285 msgstr "" 262 286 263 #: admin/class-crowdaa-sync-api.php:10 00287 #: admin/class-crowdaa-sync-api.php:1013 264 288 msgid "Errors when uploading category image for " 265 289 msgstr "" 266 290 267 #: admin/class-crowdaa-sync-api.php:10 61291 #: admin/class-crowdaa-sync-api.php:1074 268 292 msgid "Query error during category creation : " 269 293 msgstr "" 270 294 271 #: admin/class-crowdaa-sync-api.php:10 65295 #: admin/class-crowdaa-sync-api.php:1078 272 296 msgid "API error during category creation : " 273 297 msgstr "" 274 298 275 #: admin/class-crowdaa-sync-api.php:11 19299 #: admin/class-crowdaa-sync-api.php:1132 276 300 msgid "Query error during category update : " 277 301 msgstr "" 278 302 279 #: admin/class-crowdaa-sync-api.php:11 23303 #: admin/class-crowdaa-sync-api.php:1136 280 304 msgid "API error during category update : " 281 305 msgstr "" 282 306 283 #: admin/class-crowdaa-sync-api.php:11 58307 #: admin/class-crowdaa-sync-api.php:1171 284 308 msgid "Query error during category delete : " 285 309 msgstr "" 286 310 287 #: admin/class-crowdaa-sync-api.php:11 62311 #: admin/class-crowdaa-sync-api.php:1175 288 312 msgid "API error during category delete : " 289 313 msgstr "" … … 457 481 #: admin/class-crowdaa-sync-wp-hooks.php:95 458 482 msgid "Event category" 459 msgstr " "483 msgstr "Catégorie d'événements" 460 484 461 485 #: admin/class-crowdaa-sync-wp-hooks.php:83 … … 465 489 "dates)" 466 490 msgstr "" 491 "Si cette catégorie contient des événements (posts avec une date de début et " 492 "de fin d'événement)" 467 493 468 494 #: admin/class-crowdaa-sync-wp-hooks.php:152 … … 590 616 msgstr "Plugin de permissions utilisé" 591 617 618 #: admin/partials/crowdaa-sync-admin-display.php:200 619 msgid "Save parameters" 620 msgstr "Enregistrer les paramètres" 621 592 622 #: admin/partials/crowdaa-sync-admin-display.php:206 593 623 msgid "Add default picture to the Gallery" 594 624 msgstr "Ajouter une image par défaut" 595 625 626 #: admin/partials/crowdaa-sync-admin-display.php:223 627 msgid "Save picture" 628 msgstr "Enregistrer l'image" 629 596 630 #: admin/partials/crowdaa-sync-admin-display.php:231 597 631 msgid "Set categories to synchronize" … … 631 665 msgstr "" 632 666 667 #: admin/partials/crowdaa-sync-admin-display.php:277 668 msgid "Save mode & categories" 669 msgstr "Enregistrer le mode et les catégories" 670 633 671 #: admin/partials/crowdaa-sync-admin-display.php:285 634 672 msgid "Set feed (front-page) categories" … … 645 683 "principale." 646 684 685 #: admin/partials/crowdaa-sync-admin-display.php:325 686 msgid "Save feed categories" 687 msgstr "Enregistrer les catégories du feed" 688 647 689 #: admin/partials/crowdaa-sync-admin-display.php:334 648 690 msgid "Synchronization"
Note: See TracChangeset
for help on using the changeset viewer.