097c2b6f by Jeremy Groot

update to campign monitor plugin

1 parent 51123579
Showing 69 changed files with 1060 additions and 170 deletions
{
"require": {
"campaignmonitor/createsend-php": "^5.0"
"campaignmonitor/createsend-php": "^6.0"
}
}
......
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"hash": "ac95bee6727d63b7f76eeff290c1460c",
"content-hash": "14d0d7fbb4109cdf1d2e75483963ace9",
"content-hash": "57adffeef0b1837401aa65c780f09e79",
"packages": [
{
"name": "campaignmonitor/createsend-php",
"version": "v5.0.2",
"version": "v6.1.2",
"source": {
"type": "git",
"url": "https://github.com/campaignmonitor/createsend-php.git",
"reference": "05407e838eda316709d55011ad7328a679296988"
"reference": "922cec7fbc9da1508c18156db7693a6ddad7194e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/campaignmonitor/createsend-php/zipball/05407e838eda316709d55011ad7328a679296988",
"reference": "05407e838eda316709d55011ad7328a679296988",
"url": "https://api.github.com/repos/campaignmonitor/createsend-php/zipball/922cec7fbc9da1508c18156db7693a6ddad7194e",
"reference": "922cec7fbc9da1508c18156db7693a6ddad7194e",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"lastcraft/simpletest": "~1.1"
"simpletest/simpletest": "~1.1.3"
},
"type": "library",
"autoload": {
......@@ -34,6 +33,7 @@
"csrest_campaigns.php",
"csrest_clients.php",
"csrest_general.php",
"csrest_events.php",
"csrest_lists.php",
"csrest_people.php",
"csrest_segments.php",
......@@ -41,7 +41,9 @@
"csrest_templates.php",
"csrest_transactional_classicemail.php",
"csrest_transactional_smartemail.php",
"csrest_transactional_timeline.php"
"csrest_transactional_timeline.php",
"csrest_journeys.php",
"csrest_journey_emails.php"
]
},
"notification-url": "https://packagist.org/downloads/",
......@@ -62,7 +64,11 @@
"campaign",
"monitor"
],
"time": "2016-07-19 18:49:32"
"support": {
"issues": "https://github.com/campaignmonitor/createsend-php/issues",
"source": "https://github.com/campaignmonitor/createsend-php/tree/v6.1.2"
},
"time": "2021-10-02T04:57:43+00:00"
}
],
"packages-dev": [],
......@@ -72,5 +78,6 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
"platform-dev": [],
"plugin-api-version": "2.3.0"
}
......
......@@ -211,6 +211,7 @@ add_action('wp_ajax_load_campaign_data', 'campaign_Monitor_LoadData');
function campaign_Monitor_LoadData()
{
$action = $_POST['action'];
$year = $_POST['year'];
......@@ -223,12 +224,15 @@ function campaign_Monitor_LoadData()
$apiKey = get_option('cm_api_key');
if ($clientID !== false && $apiKey !== false) {
$auth = array('api_key' => $apiKey);
$wrap = new CS_REST_Clients(
$clientID,
$auth
);
$result = $wrap->get_campaigns();
// var_dump($result);exit;
if ($result->was_successful()) {
set_transient('cm_' . $clientID, serialize($result->response), DAY_IN_SECONDS);
} else {
......@@ -260,6 +264,7 @@ function campaign_Monitor_LoadData()
}
$results = get_posts($args);
foreach ($results as $post) : setup_postdata($post);
wp_delete_post($post->ID, true);
endforeach;
......@@ -268,6 +273,7 @@ function campaign_Monitor_LoadData()
$campaignItemArray = campaign_Monitor_GetData('DESC');
/** @var campaignItemClass $campaignItemObject */
foreach ($campaignItemArray as $campaignItemObject) {
$itemYear = (int)date("Y", strtotime($campaignItemObject->getItemDate()));
if($itemYear == $year) {
$dom = new DOMDocument;
......@@ -285,7 +291,7 @@ function campaign_Monitor_LoadData()
$DivContent = $DOMxpath->query("//div");
$postContent = $DivContent->item(0)->textContent;
$cm_post = [
'post_title' => $campaignItemObject->getItemName(),
'post_title' => $campaignItemObject->item->Subject,
'post_type' => 'campaign',
'post_status' => 'publish',
'post_content' => utf8_decode($postContent),
......
......@@ -2,6 +2,24 @@
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInite6414526548bbe1d789ba4acd123ef7d::getLoader();
......
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
matrix:
include:
- php: 5.3
dist: precise
- php: 5.4
dist: trusty
- php: 5.5
dist: trusty
- php: 5.6
- php: 7.0
- php: 7.1
- php: 7.2
- php: 7.3
- php: 7.4
- php: hhvm-3.30
before_script: composer install --dev
script: cd tests && php all_tests.php && cd ..
......
# createsend-php history
## v6.1.2 - 2nd Oct, 2021
* Changed local API timeout from 20 secs to 120 secs to cater for changes on get segment subscribers API endpoint.
## v6.1.1 - 6th May, 2020
* Add PHP 7.4 Support
## v6.1.0 - 3rd September, 2019
* Added support for the Journeys API (https://www.campaignmonitor.com/api/journeys/)
## v6.0.0 - 23 May, 2018
* Upgrades to Createsend API v3.2 which includes new breaking changes
* Breaking: 'Consent to track' field is now mandatory for sending smart and classic transactionl emails
* Breaking: 'Consent to track' field is now mandatory when adding or updating subscribers
* Optional 'Include tracking preference' field when retrieving lists of subscribers
## v5.1.3 - 15th May, 2017
* Changed local API timeout from 10 sec to 20 sec
## v5.1.2 - 15th May, 2017
* Added support for Behavioral Event data
## v5.0.2 - 18 July, 2016
* Prevent definition re-declarations
......
# createsend [![Build Status](https://secure.travis-ci.org/campaignmonitor/createsend-php.png)][travis]
# createsend [![Build Status](https://app.travis-ci.com/campaignmonitor/createsend-php.svg?branch=master)](https://app.travis-ci.com/campaignmonitor/createsend-php)
A PHP library which implements the complete functionality of the [Campaign Monitor API](http://www.campaignmonitor.com/api/).
[travis]: http://travis-ci.org/campaignmonitor/createsend-php
## Installation
If you use [Composer](http://getcomposer.org/), you can add [campaignmonitor/createsend-php](https://packagist.org/packages/campaignmonitor/createsend-php) to your `composer.json` file:
### Composer
If you use [Composer](http://getcomposer.org/), you can run the following command from the root of your project:
```
composer require campaignmonitor/createsend-php
```
Or add [campaignmonitor/createsend-php](https://packagist.org/packages/campaignmonitor/createsend-php) to your `composer.json` file:
```json
{
......@@ -15,6 +20,13 @@ If you use [Composer](http://getcomposer.org/), you can add [campaignmonitor/cre
}
```
Followed by running:
```
composer update
```
### Manual Installation
Otherwise you can simply [download](https://github.com/campaignmonitor/createsend-php/tags) the library and include it in your project.
After you have installed the library, simply include the relevant API class, as follows:
......@@ -120,6 +132,8 @@ $wrap = new CS_REST_General($auth);
$result = $wrap->get_clients();
var_dump($result->response);
```
## API Call Timeout
You can set your local API call timeout time in createsend-php\class\transport.php line 11, in the CS_REST_CALL_TIMEOUT variable. Currently the default is 120 secs.
## Examples
......
......@@ -4,7 +4,7 @@ require_once dirname(__FILE__).'/serialisation.php';
require_once dirname(__FILE__).'/transport.php';
require_once dirname(__FILE__).'/log.php';
defined('CS_REST_WRAPPER_VERSION') or define('CS_REST_WRAPPER_VERSION', '5.0.2');
defined('CS_REST_WRAPPER_VERSION') or define('CS_REST_WRAPPER_VERSION', '6.1.2');
defined('CS_HOST') or define('CS_HOST', 'api.createsend.com');
defined('CS_OAUTH_BASE_URI') or define('CS_OAUTH_BASE_URI', 'https://'.CS_HOST.'/oauth');
defined('CS_OAUTH_TOKEN_URI') or define('CS_OAUTH_TOKEN_URI', CS_OAUTH_BASE_URI.'/token');
......@@ -146,7 +146,7 @@ if (!class_exists('CS_REST_Wrapper_Base')) {
$this->_log = is_null($log) ? new CS_REST_Log($debug_level) : $log;
$this->_protocol = $protocol;
$this->_base_route = $protocol.'://'.$host.'/api/v3.1/';
$this->_base_route = $protocol.'://'.$host.'/api/v3.2/';
$this->_log->log_message('Creating wrapper for '.$this->_base_route, get_class($this), CS_REST_LOG_VERBOSE);
......@@ -164,13 +164,14 @@ if (!class_exists('CS_REST_Wrapper_Base')) {
$this->_default_call_options = array (
'authdetails' => $auth_details,
'userAgent' => 'CS_REST_Wrapper v'.CS_REST_WRAPPER_VERSION.
'userAgent' => 'createsend-php v'.CS_REST_WRAPPER_VERSION.
' PHPv'.phpversion().' over '.$transport_type.' with '.$this->_serialiser->get_type(),
'contentType' => 'application/json; charset=utf-8',
'deserialise' => true,
'host' => $host,
'protocol' => $protocol
);
}
/**
......@@ -230,7 +231,13 @@ if (!class_exists('CS_REST_Wrapper_Base')) {
return $this->_call($call_options, CS_REST_DELETE, $route);
}
function get_request($route, $call_options = array()) {
function get_request($route, $include_tracking_pref = NULL, $call_options = array()) {
if(isset($include_tracking_pref)
&& is_bool($include_tracking_pref)) {
$route .= '&includeTrackingPreference='.($include_tracking_pref ? "true" : "false");
}
return $this->_call($call_options, CS_REST_GET, $route);
}
......@@ -247,29 +254,36 @@ if (!class_exists('CS_REST_Wrapper_Base')) {
return $this->get_request($route);
}
function get_request_paged($route, $page_number, $page_size, $order_field, $order_direction,
$join_char = '&') {
function get_request_paged($route, $page_number, $page_size, $order_field, $order_direction, $include_tracking_pref = NULL,
$join_char = 'deprecated') {
// Stores our query values
$query = array();
// Extract any initial queries in the route into our local query
if(strpos($route, '?') !== false) {
$parts = parse_url($route);
$route = current(explode('?', $route));
if(array_key_exists('query', $parts) && !empty($parts['query'])) {
parse_str($parts['query'], $query);
}
}
// Now selectively add supplied vars to the query
if(!is_null($page_number)) {
$route .= $join_char.'page='.$page_number;
$join_char = '&';
$query['page'] = $page_number;
}
if(!is_null($page_size)) {
$route .= $join_char.'pageSize='.$page_size;
$join_char = '&';
$query['pageSize'] = $page_size;
}
if(!is_null($order_field)) {
$route .= $join_char.'orderField='.$order_field;
$join_char = '&';
$query['orderField'] = $order_field;
}
if(!is_null($order_direction)) {
$route .= $join_char.'orderDirection='.$order_direction;
$join_char = '&';
$query['orderDirection'] = $order_direction;
}
return $this->get_request($route);
// If we ended up with a query, add it back to the route
if(!empty($query)) {
$route .= '?'.http_build_query($query);
}
return $this->get_request($route, $include_tracking_pref);
}
/**
......
<?php
if (!class_exists('Services_JSON', false)) {
require_once dirname(__FILE__).'/services_json.php';
}
if(!function_exists("CS_REST_SERIALISATION_get_available")) {
function CS_REST_SERIALISATION_get_available($log) {
$log->log_message('Getting serialiser', __FUNCTION__, CS_REST_LOG_VERBOSE);
......@@ -53,6 +49,7 @@ if (!class_exists('CS_REST_BaseSerialiser')) {
if (!class_exists('CS_REST_DoNothingSerialiser')) {
class CS_REST_DoNothingSerialiser extends CS_REST_BaseSerialiser {
function __construct() {}
function get_type() { return 'do_nothing'; }
function serialise($data) { return $data; }
function deserialise($text) {
......@@ -106,6 +103,10 @@ if (!class_exists('CS_REST_ServicesJsonSerialiser')) {
function __construct($log) {
parent::__construct($log);
if (!class_exists('Services_JSON', false)) {
require_once dirname(__FILE__).'/services_json.php';
}
$this->_serialiser = new Services_JSON();
}
......
......@@ -5,10 +5,10 @@ defined('CS_REST_POST') or define('CS_REST_POST', 'POST');
defined('CS_REST_PUT') or define('CS_REST_PUT', 'PUT');
defined('CS_REST_DELETE') or define('CS_REST_DELETE', 'DELETE');
if (false === defined('CS_REST_SOCKET_TIMEOUT')) {
define('CS_REST_SOCKET_TIMEOUT', 10);
define('CS_REST_SOCKET_TIMEOUT', 120);
}
if (false === defined('CS_REST_CALL_TIMEOUT')) {
define('CS_REST_CALL_TIMEOUT', 10);
define('CS_REST_CALL_TIMEOUT', 120);
}
if(!function_exists("CS_REST_TRANSPORT_get_available")) {
......
......@@ -16,7 +16,7 @@
"php": ">=5.3.0"
},
"require-dev": {
"lastcraft/simpletest": "~1.1"
"simpletest/simpletest": "~1.1.3"
},
"autoload": {
"classmap": [
......@@ -24,6 +24,7 @@
"csrest_campaigns.php",
"csrest_clients.php",
"csrest_general.php",
"csrest_events.php",
"csrest_lists.php",
"csrest_people.php",
"csrest_segments.php",
......@@ -31,8 +32,9 @@
"csrest_templates.php",
"csrest_transactional_classicemail.php",
"csrest_transactional_smartemail.php",
"csrest_transactional_timeline.php"
"csrest_transactional_timeline.php",
"csrest_journeys.php",
"csrest_journey_emails.php"
]
}
}
......
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "eccad7521596b5fe0d81af51ab2f16a1",
"packages": [
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "d6810a171a6fbbf05f7f1156b79fdd3d",
"packages": [],
"packages-dev": [
{
"name": "lastcraft/simpletest",
"version": "1.1.0",
"name": "simpletest/simpletest",
"version": "v1.1.7",
"source": {
"type": "git",
"url": "https://github.com/lox/simpletest",
"reference": "1.1.0"
"url": "https://github.com/simpletest/simpletest.git",
"reference": "2f8c466c114bdb9c11028a0c3e6d1380ae6a18dc"
},
"dist": {
"type": "zip",
"url": "https://github.com/lox/simpletest/zipball/1.1.0",
"reference": "1.1.0",
"url": "https://api.github.com/repos/simpletest/simpletest/zipball/2f8c466c114bdb9c11028a0c3e6d1380ae6a18dc",
"reference": "2f8c466c114bdb9c11028a0c3e6d1380ae6a18dc",
"shasum": ""
},
"require": {
"php": ">=5.0.5"
},
"replace": {
"lastcraft/simpletest": "self.version",
"vierbergenlars/simpletest": "self.version"
},
"type": "library",
"autoload": {
"classmap": [
"."
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.0+"
],
"authors": [
{
"name": "Lars Vierbergen",
"email": "vierbergenlars@gmail.com"
},
{
"name": "Lachlan Donald",
"email": "lachlan@ljd.cc"
},
{
"name": "Marcus Baker",
"email": "marcus@lastcraft.com"
"email": "marcus@lastcraft.com",
"role": "Original project lead"
},
{
"name": "Jason Sweat",
"role": "Original developer"
},
{
"name": "Travis Swicegood",
"role": "Original developer"
},
{
"name": "Perrick Penet",
"role": "Original developer"
},
{
"name": "Edward Z. Yang",
"role": "Original developer"
}
],
"description": "Unit testing, mock objects and web testing framework for PHP built around test cases.",
"homepage": "http://simpletest.org/",
"time": "2012-06-11 22:22:54"
}
"keywords": [
"SimpleTest",
"code-coverage",
"selenium",
"testing",
"unit-test"
],
"aliases": [
"time": "2015-09-21T18:19:52+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [
],
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.3.0"
},
"platform-dev": [
]
"platform-dev": []
}
......
......@@ -191,7 +191,7 @@ if (!class_exists('CS_REST_Campaigns')) {
function get_recipients($page_number = NULL, $page_size = NULL, $order_field = NULL,
$order_direction = NULL) {
return $this->get_request_paged($this->_campaigns_base_route.'recipients.json', $page_number,
$page_size, $order_field, $order_direction, '?');
$page_size, $order_field, $order_direction);
}
/**
......
......@@ -448,5 +448,22 @@ if (!class_exists('CS_REST_Clients')) {
function set_primary_contact($emailAddress) {
return $this->put_request($this->_clients_base_route.'primarycontact.json?email=' . urlencode($emailAddress), '');
}
/**
* Gets a list of journeys for the current client
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* array({
* 'ListID' => The id of the list
* 'JourneyID' => The id of the journey
* 'Name' => Name of the journey
* 'Status' => Status of the journey
* })
*/
function get_journeys() {
return $this->get_request($this->_clients_base_route.'journeys.json');
}
}
}
\ No newline at end of file
......
<?php
require_once dirname(__FILE__).'/class/base_classes.php';
/**
* Class to access a journey resource from the create send API.
* This class includes functions to retrieve journey information,such as summaries,
* recipients, opens, clicks etc.
* @author peterv
*
*/
if (!class_exists('CS_REST_Journeys')) {
class CS_REST_Journeys extends CS_REST_Wrapper_Base {
/**
* The base route of the lists resource.
* @var string
* @access private
*/
var $_journeys_base_route;
/**
* Constructor.
* @param $journey_id string The journey id to access
* @param $auth_details array Authentication details to use for API calls.
* This array must take one of the following forms:
* If using OAuth to authenticate:
* array(
* 'access_token' => 'your access token',
* 'refresh_token' => 'your refresh token')
*
* Or if using an API key:
* array('api_key' => 'your api key')
* @param $protocol string The protocol to use for requests (http|https)
* @param $debug_level int The level of debugging required CS_REST_LOG_NONE | CS_REST_LOG_ERROR | CS_REST_LOG_WARNING | CS_REST_LOG_VERBOSE
* @param $host string The host to send API requests to. There is no need to change this
* @param $log CS_REST_Log The logger to use. Used for dependency injection
* @param $serialiser The serialiser to use. Used for dependency injection
* @param $transport The transport to use. Used for dependency injection
* @access public
*/
function __construct (
$journey_id,
$auth_details,
$protocol = 'https',
$debug_level = CS_REST_LOG_NONE,
$host = 'api.createsend.com',
$log = NULL,
$serialiser = NULL,
$transport = NULL) {
parent::__construct($auth_details, $protocol, $debug_level, $host, $log, $serialiser, $transport);
$this->set_journey_id($journey_id);
}
/**
* Change the email id used for calls after construction
* @param $email_id
* @access public
*/
function set_journey_id($journey_id) {
$this->_journeys_base_route = $this->_base_route.'journeys/'.$journey_id;
}
/**
* Gets the details of the current journey
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* {
* 'JourneyID' => The journey id
* 'Name' => The name of the journey
* 'TriggerType' => The method in which the journey was triggered
* 'Status' => The status of the journey
* 'Emails' => array(
* {
* 'EmailID' => The ID of the email attached to the journey
* 'Name' => The name of the email attached to the journey
* 'Bounced' => The number of recipients who bounced
* 'Clicked' => The total number of recorded clicks
* 'Opened' => The total number of recorded opens
* 'Sent' => The total recipients of the journey email
* 'UniqueOpened' => The number of recipients who opened
* 'Unsubscribed' => The number of recipients who unsubscribed
* }
* )
*
*/
function get_journey_summary() {
return $this->get_request(trim($this->_journeys_base_route, '/').'.json');
}
}
}
......@@ -258,6 +258,7 @@ if (!class_exists('CS_REST_Lists')) {
* @param int $page_size The number of records per page
* @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE')
* @param string $order_direction The direction to order the record set ('ASC', 'DESC')
* @param boolean $include_tracking_pref Whether or not to return the ConsentToTrack value (true, false)
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* {
......@@ -285,10 +286,10 @@ if (!class_exists('CS_REST_Lists')) {
* }
*/
function get_active_subscribers($added_since = '', $page_number = NULL,
$page_size = NULL, $order_field = NULL, $order_direction = NULL) {
$page_size = NULL, $order_field = NULL, $order_direction = NULL, $include_tracking_pref = NULL) {
return $this->get_request_paged($this->_lists_base_route.'active.json?date='.urlencode($added_since),
$page_number, $page_size, $order_field, $order_direction);
$page_number, $page_size, $order_field, $order_direction, $include_tracking_pref);
}
/**
......@@ -298,6 +299,7 @@ if (!class_exists('CS_REST_Lists')) {
* @param int $page_size The number of records per page
* @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE')
* @param string $order_direction The direction to order the record set ('ASC', 'DESC')
* @param boolean $include_tracking_pref Whether or not to return the ConsentToTrack value (true, false)
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* {
......@@ -325,10 +327,10 @@ if (!class_exists('CS_REST_Lists')) {
* }
*/
function get_unconfirmed_subscribers($added_since = '', $page_number = NULL,
$page_size = NULL, $order_field = NULL, $order_direction = NULL) {
$page_size = NULL, $order_field = NULL, $order_direction = NULL, $include_tracking_pref = NULL) {
return $this->get_request_paged($this->_lists_base_route.'unconfirmed.json?date='.urlencode($added_since),
$page_number, $page_size, $order_field, $order_direction);
$page_number, $page_size, $order_field, $order_direction, $include_tracking_pref);
}
/**
......@@ -338,6 +340,7 @@ if (!class_exists('CS_REST_Lists')) {
* @param int $page_size The number of records per page
* @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE')
* @param string $order_direction The direction to order the record set ('ASC', 'DESC')
* @param boolean $include_tracking_pref Whether or not to return the ConsentToTrack value (true, false)
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* {
......@@ -365,10 +368,10 @@ if (!class_exists('CS_REST_Lists')) {
* }
*/
function get_bounced_subscribers($bounced_since = '', $page_number = NULL,
$page_size = NULL, $order_field = NULL, $order_direction = NULL) {
$page_size = NULL, $order_field = NULL, $order_direction = NULL, $include_tracking_pref = NULL) {
return $this->get_request_paged($this->_lists_base_route.'bounced.json?date='.urlencode($bounced_since),
$page_number, $page_size, $order_field, $order_direction);
$page_number, $page_size, $order_field, $order_direction, $include_tracking_pref);
}
/**
......@@ -378,6 +381,7 @@ if (!class_exists('CS_REST_Lists')) {
* @param int $page_size The number of records per page
* @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE')
* @param string $order_direction The direction to order the record set ('ASC', 'DESC')
* @param boolean $include_tracking_pref Whether or not to return the ConsentToTrack value (true, false)
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* {
......@@ -405,10 +409,10 @@ if (!class_exists('CS_REST_Lists')) {
* }
*/
function get_unsubscribed_subscribers($unsubscribed_since = '', $page_number = NULL,
$page_size = NULL, $order_field = NULL, $order_direction = NULL) {
$page_size = NULL, $order_field = NULL, $order_direction = NULL, $include_tracking_pref = NULL) {
return $this->get_request_paged($this->_lists_base_route.'unsubscribed.json?date='.urlencode($unsubscribed_since),
$page_number, $page_size, $order_field, $order_direction);
$page_number, $page_size, $order_field, $order_direction,$include_tracking_pref);
}
/**
......@@ -418,6 +422,7 @@ if (!class_exists('CS_REST_Lists')) {
* @param int $page_size The number of records per page
* @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE')
* @param string $order_direction The direction to order the record set ('ASC', 'DESC')
* @param boolean $include_tracking_pref Whether or not to return the ConsentToTrack value (true, false)
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* {
......@@ -445,10 +450,10 @@ if (!class_exists('CS_REST_Lists')) {
* }
*/
function get_deleted_subscribers($deleted_since = '', $page_number = NULL,
$page_size = NULL, $order_field = NULL, $order_direction = NULL) {
$page_size = NULL, $order_field = NULL, $order_direction = NULL, $include_tracking_pref = NULL) {
return $this->get_request_paged($this->_lists_base_route.'deleted.json?date='.urlencode($deleted_since),
$page_number, $page_size, $order_field, $order_direction);
$page_number, $page_size, $order_field, $order_direction, $include_tracking_pref);
}
/**
......
......@@ -172,6 +172,7 @@ if (!class_exists('CS_REST_Segments')) {
* @param int $page_size The number of records per page
* @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE')
* @param string $order_direction The direction to order the record set ('ASC', 'DESC')
* @param boolean $include_tracking_pref Whether or not to return the ConsentToTrack value (true, false)
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* {
......@@ -199,10 +200,10 @@ if (!class_exists('CS_REST_Segments')) {
* }
*/
function get_subscribers($subscribed_since = '', $page_number = NULL,
$page_size = NULL, $order_field = NULL, $order_direction = NULL) {
$page_size = NULL, $order_field = NULL, $order_direction = NULL, $include_tracking_pref = NULL) {
return $this->get_request_paged($this->_segments_base_route.'/active.json?date='.urlencode($subscribed_since),
$page_number, $page_size, $order_field, $order_direction);
$page_number, $page_size, $order_field, $order_direction, $include_tracking_pref);
}
}
}
\ No newline at end of file
......
......@@ -75,6 +75,7 @@ if (!class_exists('CS_REST_Subscribers')) {
* 'Value' => The value for this subscriber
* )
* )
* 'ConsentToTrack' => Subscriber tracking preference ("yes", "no")
* 'Resubscribe' => Whether we should resubscribe this subscriber if they already exist in the list
* 'RestartSubscriptionBasedAutoResponders' => Whether we should restart subscription based auto responders which are sent when the subscriber first subscribes to a list.
* )
......@@ -102,6 +103,7 @@ if (!class_exists('CS_REST_Subscribers')) {
* 'Clear' => true/false (pass true to remove this custom field. in the case of a [multi-option, select many] field, pass an option in the 'Value' field to clear that option or leave Value blank to remove all options)
* )
* )
* 'ConsentToTrack' => Subscriber tracking preference ("yes", "no")
* 'Resubscribe' => Whether we should resubscribe this subscriber if they already exist in the list
* 'RestartSubscriptionBasedAutoResponders' => Whether we should restart subscription based auto responders which are sent when the subscriber first subscribes to a list.
* )
......@@ -177,8 +179,8 @@ if (!class_exists('CS_REST_Subscribers')) {
* )
* }
*/
function get($email) {
return $this->get_request($this->_subscribers_base_route.'.json?email='.urlencode($email));
function get($email, $include_tracking_pref = NULL) {
return $this->get_request($this->_subscribers_base_route.'.json?email='.urlencode($email), $include_tracking_pref);
}
/**
......
......@@ -105,10 +105,15 @@ if (!class_exists('CS_REST_Transactional_ClassicEmail')) {
* )
* )
*/
function send($message, $group = NULL, $add_to_list_ID = NULL, $options = array()) {
$group_param = array( "Group" => $group);
$add_to_list_param = array( "AddRecipientsToListID" => $add_to_list_ID);
$data = array_merge($this->_client_id_param, $message, $group_param, $add_to_list_param, $options);
function send($message, $group = NULL, $consent_to_track, $add_to_list_ID = NULL, $options = array()) {
$all_params = array(
"Group" => $group,
"AddRecipientsToListID" => $add_to_list_ID,
"ConsentToTrack" => $consent_to_track
);
$data = array_merge(
$this->_client_id_param, $message, $all_params, $options
);
return $this->post_request($this->_base_route.'transactional/classicemail/send', $data);
}
......
......@@ -140,8 +140,11 @@ if (!class_exists('CS_REST_Transactional_SmartEmail')) {
* )
* )
*/
function send($message, $add_to_list = true) {
$data = array_merge($message, array("AddRecipientsToList" => $add_to_list));
function send($message, $consent_to_track, $add_to_list = true) {
$data = array_merge($message, array(
"AddRecipientsToList" => $add_to_list,
"ConsentToTrack" => $consent_to_track
));
return $this->post_request($this->_smartemail_base_route . '/send.json', $data);
}
......@@ -153,7 +156,7 @@ if (!class_exists('CS_REST_Transactional_SmartEmail')) {
* "SmartEmailID" => string
* "Name" => string
* "CreatedAt" => string
* "Status" => stirng
* "Status" => string
* "Properties" => array (
* "From" =. string
* "ReplyTo" => string
......
<?php
require_once '../../csrest_clients.php';
$auth = array(
'access_token' => 'your access token',
'refresh_token' => 'your refresh token');
$wrap = new CS_REST_Clients(
'ClientID to get Journeys for',
$auth);
$result = $wrap->get_journeys();
echo "Result of /api/v3.2/clients/{id}/journeys\n<br />";
if($result->was_successful()) {
echo "Got journeys\n<br /><pre>";
var_dump($result->response);
} else {
echo 'Failed with code '.$result->http_status_code."\n<br /><pre>";
var_dump($result->response);
}
echo '</pre>';
\ No newline at end of file
<?php
require_once "../../csrest_events.php";
$auth = array("api_key" => "sample api key");
$client_id = "sample client id";
$api_event_type = "identify";
$wrap = new CS_REST_Events($auth, $client_id, $api_event_type);
echo "\nSending a $api_event_type event...\n";
$contact = "joe@example.org";
$event_type = "checkout";
$event_data = array(
"Page" => "/cart/checkout",
"Items" => array(
array(
"Description" => "Rubber Widget",
"Quantity" => 1,
"Price" => 300,
),
array(
"Description" => "Paint 1L",
"Quantity" => 10,
"Price" => 1,
),
),
"User" => "joe@example.org",
"CardType" => "VISA",
);
if (strcmp($wrap->getEventType(), "identify") === 0) {
// `Identify` event
$anon_id = "anonymousid-0";
$user_id = "userid-0";
$result = $wrap->track($contact, $event_type, $anon_id, $user_id, $event_data);
} else {
// `Non-identify` event (custom, shopify)
$result = $wrap->track($contact, $event_type, NULL, NULL, $event_data);
}
echo "\nEvent Sent! Here's the response:\n";
var_dump($result);
<?php
require_once '../../csrest_journey_emails.php';
$auth = array(
'access_token' => 'your access token',
'refresh_token' => 'your refresh token');
$wrap = new CS_REST_JourneyEmails('Email ID to get bounces for', $auth);
//$result = $wrap->get_journey_bounces(date('Y-m-d', strtotime('-30 days')), page, page size, order direction);
$result = $wrap->get_journey_bounces('Get bounces since', 1, 50, 'email', 'asc');
echo "Result of GET /api/v3.2/journeys/email/{id}/bounces\n<br />";
if($result->was_successful()) {
echo "Got bounces\n<br /><pre>";
var_dump($result->response);
} else {
echo 'Failed with code '.$result->http_status_code."\n<br /><pre>";
var_dump($result->response);
}
echo '</pre>';
\ No newline at end of file
<?php
require_once '../../csrest_journey_emails.php';
$auth = array(
'access_token' => 'your access token',
'refresh_token' => 'your refresh token');
$wrap = new CS_REST_JourneyEmails('Email ID to get clicks for', $auth);
//$result = $wrap->get_journey_clicks(date('Y-m-d', strtotime('-30 days')), page, page size, order direction);
$result = $wrap->get_journey_clicks('Get clicks since', 1, 50, 'email', 'asc');
echo "Result of GET /api/v3.2/journeys/email/{id}/clicks\n<br />";
if($result->was_successful()) {
echo "Got clicks\n<br /><pre>";
var_dump($result->response);
} else {
echo 'Failed with code '.$result->http_status_code."\n<br /><pre>";
var_dump($result->response);
}
echo '</pre>';
\ No newline at end of file
<?php
require_once '../../csrest_journey_emails.php';
$auth = array(
'access_token' => 'your access token',
'refresh_token' => 'your refresh token');
$wrap = new CS_REST_JourneyEmails('Email ID to get opens for', $auth);
//$result = $wrap->get_journey_opens(date('Y-m-d', strtotime('-30 days')), page, page size, order direction);
$result = $wrap->get_journey_opens('Get opens since', 1, 50, 'email', 'asc');
echo "Result of GET /api/v3.2/journeys/email/{id}/opens\n<br />";
if($result->was_successful()) {
echo "Got opens\n<br /><pre>";
var_dump($result->response);
} else {
echo 'Failed with code '.$result->http_status_code."\n<br /><pre>";
var_dump($result->response);
}
echo '</pre>';
\ No newline at end of file
<?php
require_once '../../csrest_journey_emails.php';
$auth = array(
'access_token' => 'your access token',
'refresh_token' => 'your refresh token');
$wrap = new CS_REST_JourneyEmails('Email ID to get recipients for', $auth);
//$result = $wrap->get_journey_recipients(date('Y-m-d', strtotime('-30 days')), page, page size, order direction);
$result = $wrap->get_journey_recipients('Get recipients since', 1, 50, 'email', 'asc');
echo "Result of GET /api/v3.2/journeys/email/{id}/recipients\n<br />";
if($result->was_successful()) {
echo "Got recipients\n<br /><pre>";
var_dump($result->response);
} else {
echo 'Failed with code '.$result->http_status_code."\n<br /><pre>";
var_dump($result->response);
}
echo '</pre>';
\ No newline at end of file
<?php
require_once '../../csrest_journeys.php';
$auth = array(
'access_token' => 'your access token',
'refresh_token' => 'your refresh token');
$wrap = new CS_REST_Journeys('Journey ID to get the summary of', $auth);
$result = $wrap->get_summary();
echo "Result of GET /api/v3.2/journeys/{id}\n<br />";
if($result->was_successful()) {
echo "Got summary\n<br /><pre>";
var_dump($result->response);
} else {
echo 'Failed with code '.$result->http_status_code."\n<br /><pre>";
var_dump($result->response);
}
echo '</pre>';
\ No newline at end of file
<?php
require_once '../../csrest_journey_emails.php';
$auth = array(
'access_token' => 'your access token',
'refresh_token' => 'your refresh token');
$wrap = new CS_REST_JourneyEmails('Email ID to get unsubscribes for', $auth);
//$result = $wrap->get_journey_unsubscribes(date('Y-m-d', strtotime('-30 days')), page, page size, order direction);
$result = $wrap->get_journey_unsubscribes('Get unsubscribes since', 1, 50, 'email', 'asc');
echo "Result of GET /api/v3.2/journeys/email/{id}/unsubscribes\n<br />";
if($result->was_successful()) {
echo "Got unsubscribes\n<br /><pre>";
var_dump($result->response);
} else {
echo 'Failed with code '.$result->http_status_code."\n<br /><pre>";
var_dump($result->response);
}
echo '</pre>';
\ No newline at end of file
......@@ -7,7 +7,9 @@ $auth = array(
'refresh_token' => 'your refresh token');
$wrap = new CS_REST_Lists('List ID', $auth);
$result = $wrap->get_active_subscribers('Added since', 1, 50, 'email', 'asc');
//The 6th argument will return the tracking preference of the subscribers - 'ConsentToTrack'
$result = $wrap->get_active_subscribers('Added since', 1, 50, 'email', 'asc', true);
//$result = $wrap->get_active_subscribers(date('Y-m-d', strtotime('-30 days')),
// page number, page size, order by, order direction);
......
......@@ -7,7 +7,9 @@ $auth = array(
'refresh_token' => 'your refresh token');
$wrap = new CS_REST_Segments('Segment ID', $auth);
$result = $wrap->get_subscribers('Added since', 1, 50, 'email', 'asc');
//The 6th argument will return the tracking preference of the subscribers - 'ConsentToTrack'
$result = $wrap->get_subscribers('Added since', 1, 50, 'email', 'asc', true);
//$result = $wrap->get_subscribers(date('Y-m-d', strtotime('-30 days')),
// page number, page size, order by, order description);
......
......@@ -27,6 +27,7 @@ $result = $wrap->add(array(
'Value' => 'Option 2'
)
),
'ConsentToTrack' => 'yes',
'Resubscribe' => true
));
......
......@@ -6,7 +6,9 @@ $auth = array(
'access_token' => 'your access token',
'refresh_token' => 'your refresh token');
$wrap = new CS_REST_Subscribers('Your list ID', $auth);
$result = $wrap->get('Email address');
//The 2nd argument will return the tracking preference of the subscriber - 'ConsentToTrack'
$result = $wrap->get('Email address', true);
echo "Result of GET /api/v3.1/subscribers/{list id}.{format}?email={email}\n<br />";
if($result->was_successful()) {
......
......@@ -15,6 +15,7 @@ $result = $wrap->update('Old Email Address', array(
'Value' => 'Field Value'
)
),
'ConsentToTrack' => 'unchanged',
'Resubscribe' => true
));
......
<?php
require_once "../../csrest_transactional_classicemail.php";
$client_id = "Your Client ID";
$auth = array("api_key" => "Your API Key");
$wrap = new CS_REST_Transactional_ClassicEmail($auth);
$wrap = new CS_REST_Transactional_ClassicEmail($auth, $client_id);
echo "Get the list of classic groups...\n";
$result = $wrap->groups();
......
<?php
require_once "../../csrest_transactional_classicemail.php";
$client_id = "Your Client ID";
$auth = array("api_key" => "Your API Key");
$wrap = new CS_REST_Transactional_ClassicEmail($auth, NULL);
$wrap = new CS_REST_Transactional_ClassicEmail($auth, $client_id);
echo "\nSending a simple message...\n";
......@@ -13,11 +14,12 @@ $simple_message = array(
"HTML" => "This is the HTML message body with a <a href='http://google.com'>link</a>."
);
$group_name = 'PHP test group'; # optional but great for reporting, should not be unique per message
$result = $wrap->send($simple_message, $group_name);
$consent_to_track = 'yes'; # Valid: 'yes', 'no', 'unchanged'
$result = $wrap->send($simple_message, $group_name,$consent_to_track);
echo "\nSent! Here's the response:\n";
var_dump($result->response);
echo "\nSending a message with all the options...\n";
$complex_message = array(
......@@ -48,12 +50,14 @@ $complex_message = array(
);
$group_name = "PHP test group"; # optional, great for reporting, should not be unique message
$add_recipients_to_subscriber_list_ID = "6d0366fcee146ab9bdaf3247446bbfdd"; # optional, make sure you have permission
$consent_to_track = 'yes'; # Valid: 'yes', 'no', 'unchanged'
$options = array(
"TrackOpens" => true,
"TrackClicks" => true,
"InlineCSS" => true,
); # all are true by default, but you can override
$result = $wrap->send($complex_message, $group_name, $add_recipients_to_subscriber_list_ID, $options);
$result = $wrap->send($complex_message, $group_name, $consent_to_track, $add_recipients_to_subscriber_list_ID, $options);
echo "\nSent! Here's the response:\n";
var_dump($result->response);
......
<?php
require_once "../../csrest_transactional_smartemail.php";
$client_id = "Your Client ID";
$auth = array("api_key" => "Your API Key");
$wrap = new CS_REST_Transactional_SmartEmail(NULL, $auth);
$wrap = new CS_REST_Transactional_SmartEmail(NULL, $auth, $client_id);
echo "\nGetting the list of smart emails...\n";
......
......@@ -13,7 +13,8 @@ $simple_message = array(
"username" => "janebloggs"
),
);
$result = $wrap->send($simple_message);
$consent_to_track = 'yes'; # Valid: 'yes', 'no', 'unchanged'
$result = $wrap->send($simple_message, $consent_to_track);
echo "\nSent! Here's the response:\n";
var_dump($result->response);
......@@ -47,7 +48,9 @@ $complex_message = array(
);
$add_recipients_to_subscriber_list = true;
$result = $wrap->send($complex_message, $add_recipients_to_subscriber_list);
$consent_to_track = 'yes'; # Valid: 'yes', 'no', 'unchanged'
$result = $wrap->send($complex_message, $consent_to_track, $add_recipients_to_subscriber_list);
echo "\nSent! Here's the response:\n";
var_dump($result->response);
......
<?php
require_once "../../csrest_transactional_timeline.php";
$client_id = "Your Client ID";
$auth = array("api_key" => "Your API Key");
$wrap = new CS_REST_Transactional_Timeline($auth);
$wrap = new CS_REST_Transactional_Timeline($auth, $client_id);
echo "\nGetting the statistics with the default parameters...\n";
......
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php';
require_once __DIR__.'/../vendor/lastcraft/simpletest/mock_objects.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/mock_objects.php';
class AllTests extends TestSuite {
function AllTests() {
$this->TestSuite('All Tests');
function __construct() {
parent::__construct('All Tests');
$this->addFile('class_tests/transport_test.php');
$this->addFile('class_tests/response_tests.php');
$this->addFile('csrest_test.php');
......@@ -17,5 +17,8 @@ class AllTests extends TestSuite {
$this->addFile('csrest_segments_test.php');
$this->addFile('csrest_people_test.php');
$this->addFile('csrest_administrators_test.php');
$this->addFile('csrest_events_test.php');
$this->addFile('csrest_journeys_test.php');
$this->addFile('csrest_journey_emails_test.php');
}
}
\ No newline at end of file
......
<?php
require_once __DIR__.'/../../vendor/autoload.php';
require_once __DIR__.'/../../vendor/lastcraft/simpletest/autorun.php';
require_once __DIR__.'/../../vendor/simpletest/simpletest/autorun.php';
require_once '../class/serialisation.php';
require_once '../class/log.php';
......
<?php
require_once __DIR__.'/../../vendor/autoload.php';
require_once __DIR__.'/../../vendor/lastcraft/simpletest/autorun.php';
require_once __DIR__.'/../../vendor/simpletest/simpletest/autorun.php';
require_once '../class/transport.php';
require_once '../class/log.php';
......
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
@Mock::generate('CS_REST_Log');
@Mock::generate('CS_REST_NativeJsonSerialiser');
......
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
@Mock::generate('CS_REST_Log');
@Mock::generate('CS_REST_NativeJsonSerialiser');
......
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
@Mock::generate('CS_REST_Log');
@Mock::generate('CS_REST_NativeJsonSerialiser');
......@@ -35,6 +35,14 @@ abstract class CS_REST_TestClients extends CS_REST_TestBase {
$this->general_test('get_campaigns', $call_options, $raw_result, $deserialised);
}
function testget_journeys() {
$raw_result = 'some journeys';
$deserialised = array('Journey 1', 'Journey 2');
$call_options = $this->get_call_options($this->client_base_route.'journeys.json');
$this->general_test('get_journeys', $call_options, $raw_result, $deserialised);
}
function testget_scheduled() {
$raw_result = 'some scheduled campaigns';
$deserialised = array('Campaign 1', 'Campaign 2');
......
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
@Mock::generate('CS_REST_Log');
@Mock::generate('CS_REST_NativeJsonSerialiser');
@Mock::generate('CS_REST_CurlTransport');
class CS_REST_ApiKeyTestEvents extends CS_REST_TestEvents {
var $auth = array('api_key' => 'not a real api key');
}
class CS_REST_OAuthTestEvents extends CS_REST_TestEvents {
var $auth = array(
'access_token' => '7y872y3872i3eh',
'refresh_token' => 'kjw8qjd9ow8jo');
}
abstract class CS_REST_TestEvents extends CS_REST_TestBase {
var $client_id = 'fakeclientid';
var $events_base_route;
var $event_type = "identify";
function set_up_inner() {
$this->events_base_route = $this->base_route.'events/'.$this->client_id.'/';
$this->wrapper = new CS_REST_Events($this->auth, $this->client_id, $this->event_type, $this->protocol,
$this->log_level, $this->api_host, $this->mock_log,
$this->mock_serialiser, $this->mock_transport);
}
function testtrack() {
$client_id = 'fakeclientid';
$raw_result = 'the new event id';
$email = 'test@email.com';
$event_name = 'Widget Man!';
$data = array('ExampleField'=> 'Me');
$anon_id = 'anonid-0';
$user_id = 'userid-0';
$response_code = 202;
$call_options = $this->get_call_options($this->base_route.'events/'.$this->event_type.'/'.$this->client_id.'/track', 'POST');
// `Non-identify` event (custom, shopify)
$event_info = array (
'ContactID' => array(
'Email' => 'test@email.com',
),
'EventName' => $event_name,
'Data' => array(
'ExampleField'=> 'Me'
)
);
if (strcmp($this->event_type, "identify") === 0) {
// `Identify` event
$event_info['ContactID']['AnonymousID'] = $anon_id;
$event_info['ContactID']['UserID'] = $user_id;
}
$transport_result = array (
'code' => $response_code,
'response' => $raw_result
);
$expected_result = new CS_REST_Wrapper_Result($raw_result, $response_code);
$call_options['data'] = 'event info was serialised to this';
$this->setup_transport_and_serialisation($transport_result, $call_options,
$raw_result, $raw_result, 'event info was serialised to this', $event_info, $response_code);
if (strcmp($this->event_type, "identify") == 0) {
$result = $this->wrapper->track($email, $event_name, $anon_id, $user_id, $data);
} else {
$result = $this->wrapper->track($email, $event_name, NULL, NULL, $data);
}
$this->assertIdentical($expected_result, $result);
}
}
\ No newline at end of file
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
@Mock::generate('CS_REST_Log');
@Mock::generate('CS_REST_NativeJsonSerialiser');
@Mock::generate('CS_REST_CurlTransport');
class CS_REST_ApiKeyTestJourneyEmails extends CS_REST_TestJourneyEmails {
var $auth = array('api_key' => 'not a real api key');
}
class CS_REST_OAuthTestJourneyEmails extends CS_REST_TestJourneyEmails {
var $auth = array(
'access_token' => '7y872y3872i3eh',
'refresh_token' => 'kjw8qjd9ow8jo');
}
abstract class CS_REST_TestJourneyEmails extends CS_REST_TestBase {
var $journey_email_id = 'not a real email id';
var $journey_emails_base_route;
function set_up_inner() {
$this->journey_emails_base_route = $this->base_route.'journeys/email/'.$this->journey_email_id.'/';
$this->wrapper = new CS_REST_JourneyEmails($this->journey_email_id, $this->auth, $this->protocol, $this->log_level,
$this->api_host, $this->mock_log, $this->mock_serialiser, $this->mock_transport);
}
function testget_journey_recipients() {
$raw_result = 'some recipients';
$since = '2021';
$response_code = 200;
$deserialised = array('Recipient 1', 'Recipient 2');
$call_options = $this->get_call_options(
$this->journey_emails_base_route.'opens.json?date='.$since);
$transport_result = array (
'code' => $response_code,
'response' => $raw_result
);
$expected_result = new CS_REST_Wrapper_Result($deserialised, $response_code);
$this->setup_transport_and_serialisation($transport_result, $call_options,
$deserialised, $raw_result, NULL, NULL, $response_code);
$result = $this->wrapper->get_journey_opens($since);
$this->assertIdentical($expected_result, $result);
}
function testget_journey_opens() {
$raw_result = 'some journey opens';
$since = '2021';
$response_code = 200;
$deserialised = array('Journey Open 1', 'Journey Open 2');
$call_options = $this->get_call_options(
$this->journey_emails_base_route.'opens.json?date='.$since);
$transport_result = array (
'code' => $response_code,
'response' => $raw_result
);
$expected_result = new CS_REST_Wrapper_Result($deserialised, $response_code);
$this->setup_transport_and_serialisation($transport_result, $call_options,
$deserialised, $raw_result, NULL, NULL, $response_code);
$result = $this->wrapper->get_journey_opens($since);
$this->assertIdentical($expected_result, $result);
}
function testget_journey_clicks() {
$raw_result = 'some journey clicks';
$since = '2021';
$response_code = 200;
$deserialised = array('Journey Click 1', 'Journey Click 2');
$call_options = $this->get_call_options(
$this->journey_emails_base_route.'clicks.json?date='.$since);
$transport_result = array (
'code' => $response_code,
'response' => $raw_result
);
$expected_result = new CS_REST_Wrapper_Result($deserialised, $response_code);
$this->setup_transport_and_serialisation($transport_result, $call_options,
$deserialised, $raw_result, NULL, NULL, $response_code);
$result = $this->wrapper->get_journey_clicks($since);
$this->assertIdentical($expected_result, $result);
}
function testget_journey_unsubscribes() {
$raw_result = 'some journey clicks';
$since = '2021';
$response_code = 200;
$deserialised = array('Journey Unsub 1','Journey Unsub 2');
$call_options = $this->get_call_options(
$this->journey_emails_base_route.'unsubscribes.json?date='.$since);
$transport_result = array (
'code' => $response_code,
'response' => $raw_result
);
$expected_result = new CS_REST_Wrapper_Result($deserialised, $response_code);
$this->setup_transport_and_serialisation($transport_result, $call_options,
$deserialised, $raw_result, NULL, NULL, $response_code);
$result = $this->wrapper->get_journey_unsubscribes($since);
$this->assertIdentical($expected_result, $result);
}
function testget_journey_bounces() {
$raw_result = 'some journey bounces';
$since = '2021';
$response_code = 200;
$deserialised = array('Journey Bounce 1','Journey Bounce 2');
$call_options = $this->get_call_options(
$this->journey_emails_base_route.'bounces.json?date='.$since);
$transport_result = array (
'code' => $response_code,
'response' => $raw_result
);
$expected_result = new CS_REST_Wrapper_Result($deserialised, $response_code);
$this->setup_transport_and_serialisation($transport_result, $call_options,
$deserialised, $raw_result, NULL, NULL, $response_code);
$result = $this->wrapper->get_journey_bounces($since);
$this->assertIdentical($expected_result, $result);
}
}
\ No newline at end of file
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
@Mock::generate('CS_REST_Log');
@Mock::generate('CS_REST_NativeJsonSerialiser');
@Mock::generate('CS_REST_CurlTransport');
class CS_REST_ApiKeyTestJourneys extends CS_REST_TestJourneys {
var $auth = array('api_key' => 'not a real api key');
}
class CS_REST_OAuthTestJourneys extends CS_REST_TestJourneys {
var $auth = array(
'access_token' => '7y872y3872i3eh',
'refresh_token' => 'kjw8qjd9ow8jo');
}
abstract class CS_REST_TestJourneys extends CS_REST_TestBase {
var $journey_id = 'not a real journey id';
var $journey_base_route;
function set_up_inner() {
$this->journey_base_route = $this->base_route.'journeys/'.$this->journey_id.'/';
$this->wrapper = new CS_REST_Journeys($this->journey_id, $this->auth, $this->protocol, $this->log_level,
$this->api_host, $this->mock_log, $this->mock_serialiser, $this->mock_transport);
}
function testget_journey_summary() {
$raw_result = 'journey details';
$deserialised = array(1,23,4,5);
$call_options = $this->get_call_options(trim($this->journey_base_route, '/').'.json');
$this->general_test('get_journey_summary', $call_options, $raw_result, $deserialised);
}
}
\ No newline at end of file
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
@Mock::generate('CS_REST_Log');
@Mock::generate('CS_REST_NativeJsonSerialiser');
......@@ -276,6 +276,31 @@ abstract class CS_REST_TestLists extends CS_REST_TestBase {
$this->assertIdentical($expected_result, $result);
}
function testget_active_tracking() {
$raw_result = 'some subscribers';
$since = '2020';
$response_code = 200;
$deserialised = array('Subscriber 1', 'Subscriber 2');
$tracking_pref = 'true';
$call_options = $this->get_call_options($this->list_base_route.'active.json?date='.$since.'&includeTrackingPreference='.$tracking_pref);
$transport_result = array (
'code' => $response_code,
'response' => $raw_result
);
$expected_result = new CS_REST_Wrapper_Result($deserialised, $response_code);
$this->setup_transport_and_serialisation($transport_result, $call_options,
$deserialised, $raw_result, NULL, NULL, $response_code);
$result = $this->wrapper->get_active_subscribers($since, null, null, null, null, true);
$this->assertIdentical($expected_result, $result);
}
function testget_unconfirmed_subscribers() {
$raw_result = 'some subscribers';
$since = '2020';
......
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
@Mock::generate('CS_REST_Log');
@Mock::generate('CS_REST_NativeJsonSerialiser');
......
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
@Mock::generate('CS_REST_Log');
@Mock::generate('CS_REST_NativeJsonSerialiser');
......@@ -120,7 +120,9 @@ abstract class CS_REST_TestSegments extends CS_REST_TestBase {
$segment_id = 'abc123';
$response_code = 200;
$deserialised = array('Subscriber 1', 'Subscriber 2');
$call_options = $this->get_call_options($this->segment_base_route.'/active.json?date=');
$tracking_pref = 'false';
$call_options = $this->get_call_options($this->segment_base_route.'/active.json?date=&includeTrackingPreference='.$tracking_pref);
$transport_result = array (
'code' => $response_code,
......@@ -132,7 +134,7 @@ abstract class CS_REST_TestSegments extends CS_REST_TestBase {
$this->setup_transport_and_serialisation($transport_result, $call_options,
$deserialised, $raw_result, NULL, NULL, $response_code);
$result = $this->wrapper->get_subscribers();
$result = $this->wrapper->get_subscribers(null, null, null, null, null, false);
$this->assertIdentical($expected_result, $result);
}
......
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
@Mock::generate('CS_REST_Log');
@Mock::generate('CS_REST_NativeJsonSerialiser');
......@@ -30,18 +30,21 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase {
function testadd() {
$raw_result = '';
$call_options = $this->get_call_options($this->list_base_route.'.json', 'POST');
$subscriber = array (
'Email' => 'test@test.com',
'Name' => 'Widget Man!',
'CustomFields' => array(array(1,2), array(3,4))
'CustomFields' => array(array(1,2), array(3,4)),
'ConsentToTrack' => 'yes'
);
$this->general_test_with_argument('add', $subscriber, $call_options,
$raw_result, $raw_result, 'subscriber was serialised to this');
}
function testupdate() {
$raw_result = '';
$email = 'test@test.com';
......@@ -53,7 +56,8 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase {
$subscriber = array (
'Email' => 'test2@test.com',
'Name' => 'Widget Man!',
'CustomFields' => array(array(1,2), array(3,4))
'CustomFields' => array(array(1,2), array(3,4)),
'ConsentToTrack' => 'unchanged',
);
$transport_result = array (
......@@ -86,12 +90,14 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase {
array (
'Email' => 'test@test.com',
'Name' => 'Widget Man!',
'CustomFields' => array(array(1,2), array(3,4))
'CustomFields' => array(array(1,2), array(3,4)),
'ConsentToTrack' => 'no',
),
array (
'Email' => 'test@test.com',
'Name' => 'Widget Man!',
'CustomFields' => array(array(1,2), array(3,4))
'CustomFields' => array(array(1,2), array(3,4)),
'ConsentToTrack' => 'yes',
)
);
......@@ -124,9 +130,10 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase {
$deserialised = array(1,2,34,5);
$response_code = 200;
$email = 'test@test.com';
$tracking_pref = 'true';
$call_options = $this->get_call_options(
$this->list_base_route.'.json?email='.urlencode($email), 'GET');
$this->list_base_route.'.json?email='.urlencode($email).'&includeTrackingPreference='.$tracking_pref, 'GET');
$transport_result = array (
'code' => $response_code,
......@@ -138,7 +145,7 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase {
$this->setup_transport_and_serialisation($transport_result, $call_options,
$deserialised, $raw_result, NULL, NULL, $response_code);
$result = $this->wrapper->get($email);
$result = $this->wrapper->get($email, true);
$this->assertIdentical($expected_result, $result);
}
......
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
@Mock::generate('CS_REST_Log');
@Mock::generate('CS_REST_NativeJsonSerialiser');
......
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php';
require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php';
@Mock::generate('CS_REST_Log');
@Mock::generate('CS_REST_NativeJsonSerialiser');
......@@ -31,20 +31,21 @@ class CS_REST_TestBase extends UnitTestCase {
$this->mock_transport->setReturnValue('get_type', $this->transport_type);
$this->mock_serialiser->setReturnValue('get_type', $this->serialisation_type);
$this->base_route = $this->protocol.'://'.$this->api_host.'/api/v3.1/';
$this->base_route = $this->protocol.'://'.$this->api_host.'/api/v3.2/';
$this->set_up_inner();
}
function set_up_inner() {
$this->wrapper = new CS_REST_General($this->auth, $this->protocol, $this->log_level,
$this->api_host, $this->mock_log, $this->mock_serialiser, $this->mock_transport);
$this->api_host, $this->mock_log, $this->mock_serialiser,
$this->mock_transport);
}
function get_call_options($route, $method = 'GET') {
return array (
'authdetails' => $this->auth,
'userAgent' => 'CS_REST_Wrapper v'.CS_REST_WRAPPER_VERSION.
'userAgent' => 'createsend-php v'.CS_REST_WRAPPER_VERSION.
' PHPv'.phpversion().' over '.$this->transport_type.' with '.$this->serialisation_type,
'contentType' => 'application/json; charset=utf-8',
'deserialise' => true,
......
{
"JourneyID": "183e5a8818d6202e95f1fa747b924226",
"Name": "welcome active folks",
"TriggerType": "Enters Segment",
"Status": "Active",
"Emails": [
{
"EmailID": "383ec87ea1129ebc5e539a2db35c3200",
"Name": "email",
"Bounced": 0,
"Clicked": 0,
"Opened": 1,
"Sent": 14,
"UniqueOpened": 1,
"Unsubscribed": 0
}
]
}
\ No newline at end of file
[
{
"ListID": "abcabcabcacbabcabcabcabcabc",
"JourneyID": "12345678901234567890",
"Name": "Journey One",
"Status": "Active"
},
{
"ListID": "defdefdedefdefdefdefdefdefdef",
"JourneyID": "09876543210987654321",
"Name": "Journey Two",
"Status": "Active"
}
]
\ No newline at end of file
Copyright (c) 2016 Nils Adermann, Jordi Boggiano
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
......@@ -2,14 +2,17 @@
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'CS_REST_Administrators' => $vendorDir . '/campaignmonitor/createsend-php/csrest_administrators.php',
'CS_REST_Campaigns' => $vendorDir . '/campaignmonitor/createsend-php/csrest_campaigns.php',
'CS_REST_Clients' => $vendorDir . '/campaignmonitor/createsend-php/csrest_clients.php',
'CS_REST_Events' => $vendorDir . '/campaignmonitor/createsend-php/csrest_events.php',
'CS_REST_General' => $vendorDir . '/campaignmonitor/createsend-php/csrest_general.php',
'CS_REST_JourneyEmails' => $vendorDir . '/campaignmonitor/createsend-php/csrest_journey_emails.php',
'CS_REST_Journeys' => $vendorDir . '/campaignmonitor/createsend-php/csrest_journeys.php',
'CS_REST_Lists' => $vendorDir . '/campaignmonitor/createsend-php/csrest_lists.php',
'CS_REST_People' => $vendorDir . '/campaignmonitor/createsend-php/csrest_people.php',
'CS_REST_Segments' => $vendorDir . '/campaignmonitor/createsend-php/csrest_segments.php',
......@@ -18,4 +21,5 @@ return array(
'CS_REST_Transactional_ClassicEmail' => $vendorDir . '/campaignmonitor/createsend-php/csrest_transactional_classicemail.php',
'CS_REST_Transactional_SmartEmail' => $vendorDir . '/campaignmonitor/createsend-php/csrest_transactional_smartemail.php',
'CS_REST_Transactional_Timeline' => $vendorDir . '/campaignmonitor/createsend-php/csrest_transactional_timeline.php',
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
);
......
......@@ -2,7 +2,7 @@
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
......
......@@ -2,7 +2,7 @@
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
......
......@@ -13,37 +13,23 @@ class ComposerAutoloaderInite6414526548bbe1d789ba4acd123ef7d
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInite6414526548bbe1d789ba4acd123ef7d', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInite6414526548bbe1d789ba4acd123ef7d', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInite6414526548bbe1d789ba4acd123ef7d::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
......
......@@ -10,7 +10,10 @@ class ComposerStaticInite6414526548bbe1d789ba4acd123ef7d
'CS_REST_Administrators' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_administrators.php',
'CS_REST_Campaigns' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_campaigns.php',
'CS_REST_Clients' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_clients.php',
'CS_REST_Events' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_events.php',
'CS_REST_General' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_general.php',
'CS_REST_JourneyEmails' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_journey_emails.php',
'CS_REST_Journeys' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_journeys.php',
'CS_REST_Lists' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_lists.php',
'CS_REST_People' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_people.php',
'CS_REST_Segments' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_segments.php',
......@@ -19,6 +22,7 @@ class ComposerStaticInite6414526548bbe1d789ba4acd123ef7d
'CS_REST_Transactional_ClassicEmail' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_transactional_classicemail.php',
'CS_REST_Transactional_SmartEmail' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_transactional_smartemail.php',
'CS_REST_Transactional_Timeline' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_transactional_timeline.php',
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
);
public static function getInitializer(ClassLoader $loader)
......
[
{
"packages": [
{
"name": "campaignmonitor/createsend-php",
"version": "v5.0.2",
"version_normalized": "5.0.2.0",
"version": "v6.1.2",
"version_normalized": "6.1.2.0",
"source": {
"type": "git",
"url": "https://github.com/campaignmonitor/createsend-php.git",
"reference": "05407e838eda316709d55011ad7328a679296988"
"reference": "922cec7fbc9da1508c18156db7693a6ddad7194e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/campaignmonitor/createsend-php/zipball/05407e838eda316709d55011ad7328a679296988",
"reference": "05407e838eda316709d55011ad7328a679296988",
"url": "https://api.github.com/repos/campaignmonitor/createsend-php/zipball/922cec7fbc9da1508c18156db7693a6ddad7194e",
"reference": "922cec7fbc9da1508c18156db7693a6ddad7194e",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"lastcraft/simpletest": "~1.1"
"simpletest/simpletest": "~1.1.3"
},
"time": "2016-07-19 18:49:32",
"time": "2021-10-02T04:57:43+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
......@@ -29,6 +30,7 @@
"csrest_campaigns.php",
"csrest_clients.php",
"csrest_general.php",
"csrest_events.php",
"csrest_lists.php",
"csrest_people.php",
"csrest_segments.php",
......@@ -36,7 +38,9 @@
"csrest_templates.php",
"csrest_transactional_classicemail.php",
"csrest_transactional_smartemail.php",
"csrest_transactional_timeline.php"
"csrest_transactional_timeline.php",
"csrest_journeys.php",
"csrest_journey_emails.php"
]
},
"notification-url": "https://packagist.org/downloads/",
......@@ -56,6 +60,14 @@
"api",
"campaign",
"monitor"
]
],
"support": {
"issues": "https://github.com/campaignmonitor/createsend-php/issues",
"source": "https://github.com/campaignmonitor/createsend-php/tree/v6.1.2"
},
"install-path": "../campaignmonitor/createsend-php"
}
]
],
"dev": true,
"dev-package-names": []
}
......
<?php return array(
'root' => array(
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '734b44a846bc2036531a17291e42e1b8dc4a3266',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => true,
),
'versions' => array(
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '734b44a846bc2036531a17291e42e1b8dc4a3266',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'campaignmonitor/createsend-php' => array(
'pretty_version' => 'v6.1.2',
'version' => '6.1.2.0',
'reference' => '922cec7fbc9da1508c18156db7693a6ddad7194e',
'type' => 'library',
'install_path' => __DIR__ . '/../campaignmonitor/createsend-php',
'aliases' => array(),
'dev_requirement' => false,
),
),
);
<?php
// platform_check.php @generated by Composer
$issues = array();
if (!(PHP_VERSION_ID >= 50300)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.3.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
trigger_error(
'Composer detected issues in your platform: ' . implode(' ', $issues),
E_USER_ERROR
);
}