Plugin Directory

Changeset 3270362


Ignore:
Timestamp:
04/10/2025 11:08:50 AM (11 months ago)
Author:
crowdaa
Message:

Added version 2.1.0

Location:
crowdaa-sync
Files:
4 edited
43 copied

Legend:

Unmodified
Added
Removed
  • crowdaa-sync/tags/2.1.0/CHANGELOG

    r3230431 r3270362  
    77
    88## [Unreleased]
     9
     10## [2.1.0] - 2025-04-10
     11
     12### Changed
     13
     14- Made some APIs permanently public (previous mistake)
     15
     16### Added
     17
     18- New API to delete wp posts from the Crowdaa API
    919
    1020## [2.0.2] - 2025-01-28
  • crowdaa-sync/tags/2.1.0/README.txt

    r3230431 r3270362  
    66Requires PHP: 7.3
    77Tested up to: 5.9
    8 Stable tag: 2.0.2
     8Stable tag: 2.1.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • crowdaa-sync/tags/2.1.0/admin/class-crowdaa-sync-rest-api.php

    r3230431 r3270362  
    4747        'permission_callback' => array($this, 'permission_allow_all_api'),
    4848      ));
    49       register_rest_route($this->namespace_v1, 'session/checks', array(
    50         'methods' => 'GET',
    51         'callback' => array($this, 'session_checks'),
    52         'permission_callback' => array($this, 'permission_allow_auth_api'),
    53       ));
    54       register_rest_route($this->namespace_v1, 'sync/badges/users', array(
    55         'methods' => 'POST',
    56         'callback' => array($this, 'sync_badges'),
    57         'permission_callback' => array($this, 'permission_allow_all_api'),
    58       ));
    59     }
     49    }
     50
     51    register_rest_route($this->namespace_v1, 'session/checks', array(
     52      'methods' => 'GET',
     53      'callback' => array($this, 'session_checks'),
     54      'permission_callback' => array($this, 'permission_allow_auth_api'),
     55    ));
     56    register_rest_route($this->namespace_v1, 'sync/badges/users', array(
     57      'methods' => 'POST',
     58      'callback' => array($this, 'sync_badges'),
     59      'permission_callback' => array($this, 'permission_allow_all_api'),
     60    ));
     61
     62    register_rest_route($this->namespace_v1, 'sync/article/removed', array(
     63      'methods' => 'POST',
     64      'callback' => array($this, 'sync_article_removed'),
     65      'permission_callback' => array($this, 'permission_allow_all_api'),
     66    ));
     67  }
     68
     69  public function sync_article_removed($request)
     70  {
     71    $response = array();
     72    $parameters = $request->get_json_params();
     73    $articleId = $parameters['articleId'];
     74
     75    $raw_wp_post = get_posts([
     76      'post_type'    => 'post',
     77      'post_status'  => 'any',
     78      'meta_key'     => 'api_post_id',
     79      'meta_compare' => '=',
     80      'meta_value'   => $articleId,
     81    ]);
     82
     83    if (count($raw_wp_post) === 0) {
     84      Crowdaa_Sync_Logs::log('Crowdaa_Sync_Rest_Api::sync_article_removed() : Article not found', $articleId);
     85      return new WP_REST_Response($response, 200);
     86    }
     87    $raw_wp_post = $raw_wp_post[0];
     88
     89    $crowdaa_sync_articles_api_to_wp_enabled = (get_option('crowdaa_sync_articles_api_to_wp_enabled', 'yes') === 'yes');
     90    if ($crowdaa_sync_articles_api_to_wp_enabled) {
     91      wp_delete_post($raw_wp_post->ID);
     92    } else {
     93      delete_post_meta($raw_wp_post->ID, 'crowdaa_need_sync');
     94      delete_post_meta($raw_wp_post->ID, 'crowdaa_version');
     95      delete_post_meta($raw_wp_post->ID, 'crowdaa_last_api_update');
     96      delete_post_meta($raw_wp_post->ID, 'crowdaa_last_wp_update');
     97      delete_post_meta($raw_wp_post->ID, 'api_post_id');
     98    }
     99
     100    $response['removed'] = true;
     101    return new WP_REST_Response($response, 200);
    60102  }
    61103
  • crowdaa-sync/tags/2.1.0/crowdaa-sync.php

    r3230431 r3270362  
    1414 * Plugin URI:       
    1515 * Description:       Plugin for synchronizing WordPress site and Crowdaa CMS
    16  * Version:           2.0.2
     16 * Version:           2.1.0
    1717 * Requires at least: 5.5
    1818 * Requires PHP:      7.2
     
    3434 * Uses SemVer - https://semver.org
    3535 */
    36 define('CROWDAA_SYNC_VERSION', '2.0.2');
     36define('CROWDAA_SYNC_VERSION', '2.1.0');
    3737define('CROWDAA_SYNC_PLUGIN_DIR', __DIR__);
    3838define('CROWDAA_SYNC_PLUGIN_NAME', 'crowdaa-sync');
  • crowdaa-sync/trunk/CHANGELOG

    r3230431 r3270362  
    77
    88## [Unreleased]
     9
     10## [2.1.0] - 2025-04-10
     11
     12### Changed
     13
     14- Made some APIs permanently public (previous mistake)
     15
     16### Added
     17
     18- New API to delete wp posts from the Crowdaa API
    919
    1020## [2.0.2] - 2025-01-28
  • crowdaa-sync/trunk/README.txt

    r3230431 r3270362  
    66Requires PHP: 7.3
    77Tested up to: 5.9
    8 Stable tag: 2.0.2
     8Stable tag: 2.1.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • crowdaa-sync/trunk/admin/class-crowdaa-sync-rest-api.php

    r3230431 r3270362  
    4747        'permission_callback' => array($this, 'permission_allow_all_api'),
    4848      ));
    49       register_rest_route($this->namespace_v1, 'session/checks', array(
    50         'methods' => 'GET',
    51         'callback' => array($this, 'session_checks'),
    52         'permission_callback' => array($this, 'permission_allow_auth_api'),
    53       ));
    54       register_rest_route($this->namespace_v1, 'sync/badges/users', array(
    55         'methods' => 'POST',
    56         'callback' => array($this, 'sync_badges'),
    57         'permission_callback' => array($this, 'permission_allow_all_api'),
    58       ));
    59     }
     49    }
     50
     51    register_rest_route($this->namespace_v1, 'session/checks', array(
     52      'methods' => 'GET',
     53      'callback' => array($this, 'session_checks'),
     54      'permission_callback' => array($this, 'permission_allow_auth_api'),
     55    ));
     56    register_rest_route($this->namespace_v1, 'sync/badges/users', array(
     57      'methods' => 'POST',
     58      'callback' => array($this, 'sync_badges'),
     59      'permission_callback' => array($this, 'permission_allow_all_api'),
     60    ));
     61
     62    register_rest_route($this->namespace_v1, 'sync/article/removed', array(
     63      'methods' => 'POST',
     64      'callback' => array($this, 'sync_article_removed'),
     65      'permission_callback' => array($this, 'permission_allow_all_api'),
     66    ));
     67  }
     68
     69  public function sync_article_removed($request)
     70  {
     71    $response = array();
     72    $parameters = $request->get_json_params();
     73    $articleId = $parameters['articleId'];
     74
     75    $raw_wp_post = get_posts([
     76      'post_type'    => 'post',
     77      'post_status'  => 'any',
     78      'meta_key'     => 'api_post_id',
     79      'meta_compare' => '=',
     80      'meta_value'   => $articleId,
     81    ]);
     82
     83    if (count($raw_wp_post) === 0) {
     84      Crowdaa_Sync_Logs::log('Crowdaa_Sync_Rest_Api::sync_article_removed() : Article not found', $articleId);
     85      return new WP_REST_Response($response, 200);
     86    }
     87    $raw_wp_post = $raw_wp_post[0];
     88
     89    $crowdaa_sync_articles_api_to_wp_enabled = (get_option('crowdaa_sync_articles_api_to_wp_enabled', 'yes') === 'yes');
     90    if ($crowdaa_sync_articles_api_to_wp_enabled) {
     91      wp_delete_post($raw_wp_post->ID);
     92    } else {
     93      delete_post_meta($raw_wp_post->ID, 'crowdaa_need_sync');
     94      delete_post_meta($raw_wp_post->ID, 'crowdaa_version');
     95      delete_post_meta($raw_wp_post->ID, 'crowdaa_last_api_update');
     96      delete_post_meta($raw_wp_post->ID, 'crowdaa_last_wp_update');
     97      delete_post_meta($raw_wp_post->ID, 'api_post_id');
     98    }
     99
     100    $response['removed'] = true;
     101    return new WP_REST_Response($response, 200);
    60102  }
    61103
  • crowdaa-sync/trunk/crowdaa-sync.php

    r3230431 r3270362  
    1414 * Plugin URI:       
    1515 * Description:       Plugin for synchronizing WordPress site and Crowdaa CMS
    16  * Version:           2.0.2
     16 * Version:           2.1.0
    1717 * Requires at least: 5.5
    1818 * Requires PHP:      7.2
     
    3434 * Uses SemVer - https://semver.org
    3535 */
    36 define('CROWDAA_SYNC_VERSION', '2.0.2');
     36define('CROWDAA_SYNC_VERSION', '2.1.0');
    3737define('CROWDAA_SYNC_PLUGIN_DIR', __DIR__);
    3838define('CROWDAA_SYNC_PLUGIN_NAME', 'crowdaa-sync');
Note: See TracChangeset for help on using the changeset viewer.