Plugin Directory

Changeset 2555982


Ignore:
Timestamp:
06/29/2021 04:41:10 PM (5 years ago)
Author:
impacttechpartners
Message:

added get impact-settings endpoint, release 1.0.8

Location:
impact-partnership-cloud
Files:
2 edited
6 copied

Legend:

Unmodified
Added
Removed
  • impact-partnership-cloud/tags/1.0.8/impact.php

    r2555944 r2555982  
    33 * Plugin Name:       Impact: Partnership Cloud
    44 * Description:       Partnership cloud app plugin for Woocomerce that tracks every conversion made trough one of Impact's referral links.
    5  * Version:           1.0.7
     5 * Version:           1.0.8
    66 * Requires at least: 5.0
    77 * Requires PHP:      7.0
     
    2323{
    2424
    25   private $version = "1.0.7";
     25  private $version = "1.0.8";
    2626  static $instance = false;
    2727
     
    6666      'permission_callback' => '__return_true'
    6767    ) );
     68    register_rest_route("impact/v1/", "impact-settings", [
     69      "methods" => "GET",
     70      "callback" => [$this, "impact_handle_get_impact_settings_callback"],
     71      "permission_callback" => "__return_true"
     72    ]);
    6873  }
    6974
     
    124129    }
    125130    add_option("impact_request_value", $consumer_key);
     131  }
     132
     133  public function impact_handle_get_impact_settings_callback($request)
     134  {
     135    if (!isset($request["consumer_key"])) {
     136      wp_send_json("request is missing consumer_key", 422);
     137      die;
     138    }
     139    $bearer = get_option("impact_request_value");
     140    $consumer_key = sanitize_text_field($request["consumer_key"]);
     141    if ($bearer != $consumer_key) {
     142      wp_send_json("consumer_key is not valid", 401);
     143      die;
     144    }
     145    $impact_settings = get_option("impact_settings_option_name");
     146    $response = [
     147      "version" => $this->version,
     148      "impact_settings" => $impact_settings
     149    ];
     150    wp_send_json($response, 200);
    126151  }
    127152
  • impact-partnership-cloud/tags/1.0.8/readme.txt

    r2555944 r2555982  
    44Tested up to: 5.7
    55Requires PHP: 7.0
    6 Stable tag: 1.0.7
     6Stable tag: 1.0.8
    77License: GPLv2 or later License
    88URI: http://www.gnu.org/licenses/gpl-2.0.html
  • impact-partnership-cloud/trunk/impact.php

    r2555944 r2555982  
    33 * Plugin Name:       Impact: Partnership Cloud
    44 * Description:       Partnership cloud app plugin for Woocomerce that tracks every conversion made trough one of Impact's referral links.
    5  * Version:           1.0.7
     5 * Version:           1.0.8
    66 * Requires at least: 5.0
    77 * Requires PHP:      7.0
     
    2323{
    2424
    25   private $version = "1.0.7";
     25  private $version = "1.0.8";
    2626  static $instance = false;
    2727
     
    6666      'permission_callback' => '__return_true'
    6767    ) );
     68    register_rest_route("impact/v1/", "impact-settings", [
     69      "methods" => "GET",
     70      "callback" => [$this, "impact_handle_get_impact_settings_callback"],
     71      "permission_callback" => "__return_true"
     72    ]);
    6873  }
    6974
     
    124129    }
    125130    add_option("impact_request_value", $consumer_key);
     131  }
     132
     133  public function impact_handle_get_impact_settings_callback($request)
     134  {
     135    if (!isset($request["consumer_key"])) {
     136      wp_send_json("request is missing consumer_key", 422);
     137      die;
     138    }
     139    $bearer = get_option("impact_request_value");
     140    $consumer_key = sanitize_text_field($request["consumer_key"]);
     141    if ($bearer != $consumer_key) {
     142      wp_send_json("consumer_key is not valid", 401);
     143      die;
     144    }
     145    $impact_settings = get_option("impact_settings_option_name");
     146    $response = [
     147      "version" => $this->version,
     148      "impact_settings" => $impact_settings
     149    ];
     150    wp_send_json($response, 200);
    126151  }
    127152
  • impact-partnership-cloud/trunk/readme.txt

    r2555944 r2555982  
    44Tested up to: 5.7
    55Requires PHP: 7.0
    6 Stable tag: 1.0.7
     6Stable tag: 1.0.8
    77License: GPLv2 or later License
    88URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.