097c2b6f by Jeremy Groot

update to campign monitor plugin

1 parent 51123579
Showing 69 changed files with 2299 additions and 295 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);
}
/**
......@@ -300,4 +314,4 @@ if (!class_exists('CS_REST_Wrapper_Base')) {
return new CS_REST_Wrapper_Result($call_result['response'], $call_result['code']);
}
}
}
\ No newline at end of file
}
......
<?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();
}
......
......@@ -153,7 +153,7 @@ if (!class_exists('Services_JSON')) {
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
}
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
$bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
switch(true) {
case ((0x7F & $bytes) == $bytes):
......@@ -206,17 +206,17 @@ if (!class_exists('Services_JSON')) {
case 2:
// return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x07 & (ord($utf8{0}) >> 2))
. chr((0xC0 & (ord($utf8{0}) << 6))
| (0x3F & ord($utf8{1})));
return chr(0x07 & (ord($utf8[0]) >> 2))
. chr((0xC0 & (ord($utf8[0]) << 6))
| (0x3F & ord($utf8[1])));
case 3:
// return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr((0xF0 & (ord($utf8{0}) << 4))
| (0x0F & (ord($utf8{1}) >> 2)))
. chr((0xC0 & (ord($utf8{1}) << 6))
| (0x7F & ord($utf8{2})));
return chr((0xF0 & (ord($utf8[0]) << 4))
| (0x0F & (ord($utf8[1]) >> 2)))
. chr((0xC0 & (ord($utf8[1]) << 6))
| (0x7F & ord($utf8[2])));
}
// ignoring UTF-32 for now, sorry
......@@ -261,7 +261,7 @@ if (!class_exists('Services_JSON')) {
*/
for ($c = 0; $c < $strlen_var; ++$c) {
$ord_var_c = ord($var{$c});
$ord_var_c = ord($var[$c]);
switch (true) {
case $ord_var_c == 0x08:
......@@ -284,18 +284,18 @@ if (!class_exists('Services_JSON')) {
case $ord_var_c == 0x2F:
case $ord_var_c == 0x5C:
// double quote, slash, slosh
$ascii .= '\\'.$var{$c};
$ascii .= '\\'.$var[$c];
break;
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
// characters U-00000000 - U-0000007F (same as ASCII)
$ascii .= $var{$c};
$ascii .= $var[$c];
break;
case (($ord_var_c & 0xE0) == 0xC0):
// characters U-00000080 - U-000007FF, mask 110XXXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
$char = pack('C*', $ord_var_c, ord($var[$c + 1]));
$c += 1;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
......@@ -305,8 +305,8 @@ if (!class_exists('Services_JSON')) {
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}));
ord($var[$c + 1]),
ord($var[$c + 2]));
$c += 2;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
......@@ -316,9 +316,9 @@ if (!class_exists('Services_JSON')) {
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}));
ord($var[$c + 1]),
ord($var[$c + 2]),
ord($var[$c + 3]));
$c += 3;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
......@@ -328,10 +328,10 @@ if (!class_exists('Services_JSON')) {
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}),
ord($var{$c + 4}));
ord($var[$c + 1]),
ord($var[$c + 2]),
ord($var[$c + 3]),
ord($var[$c + 4]));
$c += 4;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
......@@ -341,11 +341,11 @@ if (!class_exists('Services_JSON')) {
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}),
ord($var{$c + 4}),
ord($var{$c + 5}));
ord($var[$c + 1]),
ord($var[$c + 2]),
ord($var[$c + 3]),
ord($var[$c + 4]),
ord($var[$c + 5]));
$c += 5;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
......@@ -520,7 +520,7 @@ if (!class_exists('Services_JSON')) {
for ($c = 0; $c < $strlen_chrs; ++$c) {
$substr_chrs_c_2 = substr($chrs, $c, 2);
$ord_chrs_c = ord($chrs{$c});
$ord_chrs_c = ord($chrs[$c]);
switch (true) {
case $substr_chrs_c_2 == '\b':
......@@ -550,7 +550,7 @@ if (!class_exists('Services_JSON')) {
case $substr_chrs_c_2 == '\\/':
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
$utf8 .= $chrs{++$c};
$utf8 .= $chrs[++$c];
}
break;
......@@ -563,7 +563,7 @@ if (!class_exists('Services_JSON')) {
break;
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
$utf8 .= $chrs{$c};
$utf8 .= $chrs[$c];
break;
case ($ord_chrs_c & 0xE0) == 0xC0:
......@@ -610,7 +610,7 @@ if (!class_exists('Services_JSON')) {
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
// array, or object notation
if ($str{0} == '[') {
if ($str[0] == '[') {
$stk = array(SERVICES_JSON_IN_ARR);
$arr = array();
} else {
......@@ -649,7 +649,7 @@ if (!class_exists('Services_JSON')) {
$top = end($stk);
$substr_chrs_c_2 = substr($chrs, $c, 2);
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
if (($c == $strlen_chrs) || (($chrs[$c] == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
// found a comma that is not inside a string, array, etc.,
// OR we've reached the end of the character list
$slice = substr($chrs, $top['where'], ($c - $top['where']));
......@@ -691,12 +691,12 @@ if (!class_exists('Services_JSON')) {
}
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
} elseif ((($chrs[$c] == '"') || ($chrs[$c] == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
// found a quote, and we are not inside a string
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c]));
//print("Found start of string at {$c}\n");
} elseif (($chrs{$c} == $top['delim']) &&
} elseif (($chrs[$c] == $top['delim']) &&
($top['what'] == SERVICES_JSON_IN_STR) &&
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
// found a quote, we're in a string, and it's not escaped
......@@ -705,24 +705,24 @@ if (!class_exists('Services_JSON')) {
array_pop($stk);
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
} elseif (($chrs{$c} == '[') &&
} elseif (($chrs[$c] == '[') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-bracket, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
//print("Found start of array at {$c}\n");
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
} elseif (($chrs[$c] == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
// found a right-bracket, and we're in an array
array_pop($stk);
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
} elseif (($chrs{$c} == '{') &&
} elseif (($chrs[$c] == '{') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-brace, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
//print("Found start of object at {$c}\n");
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
} elseif (($chrs[$c] == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
// found a right-brace, and we're in an object
array_pop($stk);
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
......
......@@ -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"
],
"time": "2015-09-21T18:19:52+00:00"
}
],
"aliases": [
],
"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);
}
/**
......
......@@ -420,7 +420,7 @@ if (!class_exists('CS_REST_Clients')) {
* returns the people associated with this client.
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* array({
* 'EmailAddress' => the email address of the person
* 'EmailAddress' => the email address of the person
* 'Name' => the name of the person
* 'AccessLevel' => the access level of the person
* 'Status' => the status of the person
......@@ -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 send event data to the create send API.
* @author cameronn
*
*/
if (!class_exists('CS_REST_Events')) {
class CS_REST_Events extends CS_REST_Wrapper_Base {
/**
* The base route of the clients resource.
* @var string
* @access private
*/
var $_events_base_route;
/**
* The type of event supports 'shopify', 'identify' and 'custom'
* @var string
* @access private
*/
private $_event_type;
/**
* Client ID
* @var string
* @access private
*/
private $_client_id;
/**
* Anonymous ID
* @var string
* @access private
*/
private $_anonymous_id;
/**
* User ID
* @var string
* @access private
*/
private $_user_id;
/**
* Email address
* @var string
* @access private
*/
private $_email;
/**
* Indicates invalid Event
* @var bool
* @access private
*/
private $_invalid_event = false;
/**
* Constructor.
*
* @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 $client_id string The client id to send event to
* @param $event_type string The event type we support - `custom`, `identify` and `shopify`
* @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 (
$auth_details,
$client_id,
$event_type,
$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_client_id($client_id);
if (!isset($event_type)) {
trigger_error('$event_type should be one of \'custom\', \'identify\' or \'shopify\'');
}
$this->setEventType($event_type);
}
/**
* Change the client id used for calls after construction
* @param $client_id
* @access public
*/
function set_client_id($client_id) {
if (!isset($client_id)) {
trigger_error('$client_id needs to be set');
}
$this->_events_base_route = $this->_base_route.'events/'.$client_id.'/';
$this->_client_id = $client_id;
}
/**
* Set the type of event that we support: 'custom', 'identify' and 'shopify'
* @param $event_type string Event that we support: 'custom', 'identify' and 'shopify'
* @access private
*/
private function setEventType($event_type) {
if (!isset($event_type)) {
trigger_error('$event_type needs to be set');
return new CS_REST_Wrapper_Result(null, 400);
}
if (strcmp($event_type, "custom") !== 0 &&
strcmp($event_type,"identify") !== 0 &&
strcmp($event_type,"shopify") !== 0) {
trigger_error('$event_type needs to be one of \'custom\', \'identify\' or \'shopify\'');
$this->_invalid_event = true;
return new CS_REST_Wrapper_Result(null, 400);
}
$this->_event_type = $event_type;
}
/*
* Validate email address
* @param $email string email address
* @access private
*/
private function validateEmail($email) {
if (!isset($email)) {
trigger_error('$email needs to be set');
return new CS_REST_Wrapper_Result(null, 400);
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
trigger_error('$email needs to be a valid email address');
return new CS_REST_Wrapper_Result(null, 400);
}
return $email;
}
/**
* Get the event type name
* @access public
*/
function getEventType() {
return $this->_event_type;
}
/**
* Tracks an event
* @param string $email required email in the form "user@example.com"
*
* @param string $event_name. Name to group events by for reporting max length 1000
* For example "Page View", "Order confirmation"
*
* @param array $data optional. Event payload.
* This should be an array, with details of the event
* array(
* 'RandomFieldObject' => array(
* 'Example'' => 'test'
* ),
* 'RandomFieldURL' => 'Example',
* 'RandomArray' => array(1,3,5,6,7),
* )
* @param $anonymous_id string Anonymous ID to use for identify events
* @param $user_id string User ID to use for identify events
* @access public
* @return CS_REST_Wrapper_Result A successful response will include an Event ID.
* array(
* array(
* 'EventID' => 'string'
* )
* )
*/
function track($email, $event_name, $anonymous_id = NULL, $user_id = NULL, $data = NULL)
{
// Basic validation
if (!isset($event_name)) {
trigger_error('$event_name needs to be set');
return new CS_REST_Wrapper_Result(null, 400);
}
if (strlen($event_name) > 1000) {
trigger_error('$event_name needs to be shorter, max length is 1000 bytes');
return new CS_REST_Wrapper_Result(null, 400);
}
if (isset($data)) {
if (!is_array($data)) {
trigger_error('$data needs to be a valid array');
return new CS_REST_Wrapper_Result(null, 400);
}
}
if (empty($data)) {
$data = NULL;
}
if (strcmp($this->_event_type, "identify") === 0) {
return $this->sendIdentifyTrack($email, $event_name, $anonymous_id, $user_id, $data);
} elseif (strcmp($this->_event_type, "custom") === 0 || strcmp($this->_event_type, "shopify") === 0) {
return $this->sendNonIdentifyTrack($email, $event_name, $anonymous_id, $user_id, $data);
}
trigger_error('event type is invalid. Supported - custom, identify or shopify');
return new CS_REST_Wrapper_Result(null, 400);
}
/*
* Send identify track event
* @param $email string email address
* @param $event_name string event name
* @param $anonymousId string anonymous id
* @param $userId string user id
* @param $data array event data
* @access private
*/
private function sendIdentifyTrack($email, $event_name, $anonymousId, $userId, $data) {
if (!isset($email)) {
trigger_error('email needs to be a set for identify event');
return new CS_REST_Wrapper_Result(null, 400);
}
$minRequiredParam = 1; // anonymous id / user id
$paramPresent = 0;
if (isset($anonymousId)) {
$paramPresent += 1;
}
if (isset($userId)) {
$paramPresent += 1;
}
if ($paramPresent < $minRequiredParam) {
trigger_error('at least one of: anonymous id, user id needs to be set and be a valid string for identify event');
return new CS_REST_Wrapper_Result(null, 400);
}
$this->_anonymous_id = $anonymousId;
$this->_email = $this->validateEmail($email);
$this->_user_id = $userId;
$payload = array(
'ContactID' =>
array(
'Email' => $this->_email,
'AnonymousID' => $this->_anonymous_id,
'UserID' => $this->_user_id,
),
'EventName' => $event_name,
'Data' => $data
);
return $this->sendTrack($payload);
}
/*
* Send non-identify track event (custom or shopify)
* @param $email string email
* @param $event_name string event name
* @param $data array event data
*/
private function sendNonIdentifyTrack($email, $event_name, $anonymousId, $userId, $data) {
$paramPresent = 0;
if (isset($email)) {
$this->_email = $this->validateEmail($email);
$paramPresent += 1;
} else {
$this->_email = NULL;
}
$minRequiredParam = 1; // anonymous id / user id / email
if (isset($anonymousId)) {
$paramPresent += 1;
}
if (isset($userId)) {
$paramPresent += 1;
}
if ($paramPresent < $minRequiredParam) {
trigger_error('at least one of: anonymous id, user id, email needs to be set and be a valid string for identify event');
return new CS_REST_Wrapper_Result(null, 400);
}
$this->_anonymous_id = $anonymousId;
$this->_user_id = $userId;
$payload = array(
'ContactID' =>
array(
'Email' => $this->_email,
'AnonymousID' => $this->_anonymous_id,
'UserID' => $this->_user_id
),
'EventName' => $event_name,
'Data' => $data
);
return $this->sendTrack($payload);
}
/*
* Send track event payload
* @param $payload array Payload to send to track endpoint
* @access private
*/
private function sendTrack($payload) {
if ($this->_invalid_event) {
trigger_error('$event_type must be one of \'identify\', \'custom\' or \'shopify\'');
return new CS_REST_Wrapper_Result(null, 400);
}
// Basic validation before finally POST'ing
if (!isset($this->_base_route) || !isset($this->_event_type) || !isset($this->_client_id)) {
trigger_error('one of: $_base_route, $_event_type, $_client_id is missing during URL construction');
return new CS_REST_Wrapper_Result(null, 400);
}
if (isset($payload) && is_array($payload)) {
$event_url = $this->_base_route . 'events/' . $this->_event_type . '/' . $this->_client_id . '/track';
return $this->post_request($event_url, $payload);
}
trigger_error('$payload needs to be a valid array');
return new CS_REST_Wrapper_Result(null, 400);
}
}
}
<?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_JourneyEmails')) {
class CS_REST_JourneyEmails extends CS_REST_Wrapper_Base {
/**
* The base route of the lists resource.
* @var string
* @access private
*/
var $_journey_emails_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 (
$email_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_email_id($email_id);
}
/**
* Change the email id used for calls after construction
* @param $email_id
* @access public
*/
function set_email_id($email_id) {
$this->_journey_emails_base_route = $this->_base_route.'journeys/email/'.$email_id;
}
/**
* Gets all email addresses from the journey email id specified
* @param string $since The date to start getting bounces from
* @param int $page_number The page number to get
* @param int $page_size The number of records per page
* @param string $order_field Not used
* @param string $order_direction The direction to order the record set ('ASC', 'DESC')
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* {
* 'ResultsOrderedBy' => The field the results are ordered by
* 'OrderDirection' => The order direction
* 'PageNumber' => The page number for the result set
* 'PageSize' => The page size used
* 'RecordsOnThisPage' => The number of records returned
* 'TotalNumberOfRecords' => The total number of records available
* 'NumberOfPages' => The total number of pages for this collection
* 'Results' => array(
* {
* 'EmailAddress' => The email address of the subscriber
* 'SentDate' => The date the subscriber was sent the mailing
* }
* )
* }
*/
function get_journey_recipients($since = '', $page_number = NULL, $page_size = NULL, $order_field = NULL,
$order_direction = NULL) {
return $this->get_request_paged($this->_journey_emails_base_route.'/recipients.json?date='.urlencode($since), $page_number,
$page_size, $order_field, $order_direction);
}
/**
* Gets all recipients from the journey email id specified
* @param string $since The date to start getting bounces from
* @param int $page_number The page number to get
* @param int $page_size The number of records per page
* @param string $order_field Not used
* @param string $order_direction The direction to order the record set ('ASC', 'DESC')
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* {
* 'ResultsOrderedBy' => The field the results are ordered by
* 'OrderDirection' => The order direction
* 'PageNumber' => The page number for the result set
* 'PageSize' => The page size used
* 'RecordsOnThisPage' => The number of records returned
* 'TotalNumberOfRecords' => The total number of records available
* 'NumberOfPages' => The total number of pages for this collection
* 'Results' => array(
* {
* 'EmailAddress' => The email address of the subscriber who opened
* 'Date' => The date of the open
* 'IPAddress' => The ip address where the open originated
* 'Latitude' => The geocoded latitude from the IP address
* 'Longitude' => The geocoded longitude from the IP address
* 'City' => The geocoded city from the IP address
* 'Region' => The geocoded region from the IP address
* 'CountryCode' => The geocoded two letter country code from the IP address
* 'CountryName' => The geocoded full country name from the IP address
* }
* )
* }
*/
function get_journey_opens($since = '', $page_number = NULL, $page_size = NULL, $order_field = NULL,
$order_direction = NULL) {
return $this->get_request_paged($this->_journey_emails_base_route.'/opens.json?date='.urlencode($since), $page_number,
$page_size, $order_field, $order_direction);
}
/**
* Gets all recipients who opened the journey email
* @param string $since The date to start getting bounces from
* @param int $page_number The page number to get
* @param int $page_size The number of records per page
* @param string $order_field Not used
* @param string $order_direction The direction to order the record set ('ASC', 'DESC')
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* {
* 'ResultsOrderedBy' => The field the results are ordered by
* 'OrderDirection' => The order direction
* 'PageNumber' => The page number for the result set
* 'PageSize' => The page size used
* 'RecordsOnThisPage' => The number of records returned
* 'TotalNumberOfRecords' => The total number of records available
* 'NumberOfPages' => The total number of pages for this collection
* 'Results' => array(
* {
* 'EmailAddress' => The email address of the subscriber who clicked
* 'Date' => The date of the click
* 'URL' => The URL of the link that was clicked
* 'IPAddress' => The ip address where the click originated
* 'Latitude' => The geocoded latitude from the IP address
* 'Longitude' => The geocoded longitude from the IP address
* 'City' => The geocoded city from the IP address
* 'Region' => The geocoded region from the IP address
* 'CountryCode' => The geocoded two letter country code from the IP address
* 'CountryName' => The geocoded full country name from the IP address
* }
* )
* }
*/
function get_journey_clicks($since = '', $page_number = NULL, $page_size = NULL, $order_field = NULL,
$order_direction = NULL) {
return $this->get_request_paged($this->_journey_emails_base_route.'/clicks.json?date='.urlencode($since), $page_number,
$page_size, $order_field, $order_direction);
}
/**
* Gets all recipients who unsubscribed from the journey email
* @param string $since The date to start getting bounces from
* @param int $page_number The page number to get
* @param int $page_size The number of records per page
* @param string $order_field Not used
* @param string $order_direction The direction to order the record set ('ASC', 'DESC')
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* {
* 'ResultsOrderedBy' => The field the results are ordered by
* 'OrderDirection' => The order direction
* 'PageNumber' => The page number for the result set
* 'PageSize' => The page size used
* 'RecordsOnThisPage' => The number of records returned
* 'TotalNumberOfRecords' => The total number of records available
* 'NumberOfPages' => The total number of pages for this collection
* 'Results' => array(
* {
* 'EmailAddress' => The email address of the subscriber who unsubscribed
* 'Date' => The date of the unsubscribe
* 'IPAddress' => The ip address where the unsubscribe originated
* }
* )
* }
*/
function get_journey_unsubscribes($since = '', $page_number = NULL, $page_size = NULL, $order_field = NULL,
$order_direction = NULL) {
return $this->get_request_paged($this->_journey_emails_base_route.'/unsubscribes.json?date='.urlencode($since), $page_number,
$page_size, $order_field, $order_direction);
}
/**
* Gets all recipients who bounced from the journey email send
* @param string $since The date to start getting bounces from
* @param int $page_number The page number to get
* @param int $page_size The number of records per page
* @param string $order_field Not used
* @param string $order_direction The direction to order the record set ('ASC', 'DESC')
* @access public
* @return CS_REST_Wrapper_Result A successful response will be an object of the form
* {
* 'ResultsOrderedBy' => The field the results are ordered by
* 'OrderDirection' => The order direction
* 'PageNumber' => The page number for the result set
* 'PageSize' => The page size used
* 'RecordsOnThisPage' => The number of records returned
* 'TotalNumberOfRecords' => The total number of records available
* 'NumberOfPages' => The total number of pages for this collection
* 'Results' => array(
* {
* 'EmailAddress' => The email address of the subscriber who unsubscribed
* 'BounceType' => The bounce type
* 'Date' => The date of the bounce
* 'Reason' => The reason for the bounce
* }
* )
* }
*/
function get_journey_bounces($since = '', $page_number = NULL, $page_size = NULL, $order_field = NULL,
$order_direction = NULL) {
return $this->get_request_paged($this->_journey_emails_base_route.'/bounces.json?date='.urlencode($since), $page_number,
$page_size, $order_field, $order_direction);
}
}
}
<?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
......@@ -37,56 +37,134 @@ namespace Composer\Autoload;
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
/** @var \Closure(string):void */
private static $includeFile;
/** @var ?string */
private $vendorDir;
// PSR-4
/**
* @var array[]
* @psalm-var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, array<int, string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* @var array[]
* @psalm-var array<string, array<string, string[]>>
*/
private $prefixesPsr0 = array();
/**
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var string[]
* @psalm-var array<string, string>
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var bool[]
* @psalm-var array<string, bool>
*/
private $missingClasses = array();
/** @var ?string */
private $apcuPrefix;
/**
* @var self[]
*/
private static $registeredLoaders = array();
/**
* @param ?string $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
}
/**
* @return string[]
*/
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();
}
/**
* @return array[]
* @psalm-return array<string, array<int, string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return string[] Array of classname => path
* @psalm-return array<string, string>
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
* @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $classMap
*
* @return void
*/
public function addClassMap(array $classMap)
{
......@@ -101,9 +179,11 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
......@@ -146,11 +226,13 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
......@@ -194,8 +276,10 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 base directories
*
* @return void
*/
public function set($prefix, $paths)
{
......@@ -210,10 +294,12 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPsr4($prefix, $paths)
{
......@@ -233,6 +319,8 @@ class ClassLoader
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*
* @return void
*/
public function setUseIncludePath($useIncludePath)
{
......@@ -255,6 +343,8 @@ class ClassLoader
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*
* @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
......@@ -272,36 +362,80 @@ class ClassLoader
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*
* @return void
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) {
return;
}
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}
/**
* Unregisters this instance as an autoloader.
*
* @return void
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
$includeFile = self::$includeFile;
$includeFile($file);
return true;
}
return null;
}
/**
......@@ -313,11 +447,6 @@ class ClassLoader
*/
public function findFile($class)
{
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
......@@ -325,6 +454,12 @@ class ClassLoader
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
......@@ -333,6 +468,10 @@ class ClassLoader
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
......@@ -341,6 +480,21 @@ class ClassLoader
return $file;
}
/**
* Returns the currently registered loaders indexed by their corresponding vendor directories.
*
* @return self[]
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
......@@ -348,10 +502,14 @@ class ClassLoader
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
if (0 === strpos($class, $prefix)) {
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
......@@ -402,14 +560,26 @@ class ClassLoader
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
/**
* @return void
*/
private static function initializeIncludeClosure()
{
if (self::$includeFile !== null) {
return;
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
}
......
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed;
}
}
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';
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);
}
}
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInite6414526548bbe1d789ba4acd123ef7d::getInitializer($loader));
$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)
......
[
{
"name": "campaignmonitor/createsend-php",
"version": "v5.0.2",
"version_normalized": "5.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/campaignmonitor/createsend-php.git",
"reference": "05407e838eda316709d55011ad7328a679296988"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/campaignmonitor/createsend-php/zipball/05407e838eda316709d55011ad7328a679296988",
"reference": "05407e838eda316709d55011ad7328a679296988",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"lastcraft/simpletest": "~1.1"
},
"time": "2016-07-19 18:49:32",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"csrest_administrators.php",
"csrest_campaigns.php",
"csrest_clients.php",
"csrest_general.php",
"csrest_lists.php",
"csrest_people.php",
"csrest_segments.php",
"csrest_subscribers.php",
"csrest_templates.php",
"csrest_transactional_classicemail.php",
"csrest_transactional_smartemail.php",
"csrest_transactional_timeline.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Toby Brain",
"email": "tobio85@gmail.com",
"role": "Developer"
}
],
"description": "A php library which implements the complete functionality of the Campaign Monitor API.",
"homepage": "http://campaignmonitor.github.io/createsend-php/",
"keywords": [
"api",
"campaign",
"monitor"
]
}
]
{
"packages": [
{
"name": "campaignmonitor/createsend-php",
"version": "v6.1.2",
"version_normalized": "6.1.2.0",
"source": {
"type": "git",
"url": "https://github.com/campaignmonitor/createsend-php.git",
"reference": "922cec7fbc9da1508c18156db7693a6ddad7194e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/campaignmonitor/createsend-php/zipball/922cec7fbc9da1508c18156db7693a6ddad7194e",
"reference": "922cec7fbc9da1508c18156db7693a6ddad7194e",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"simpletest/simpletest": "~1.1.3"
},
"time": "2021-10-02T04:57:43+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"csrest_administrators.php",
"csrest_campaigns.php",
"csrest_clients.php",
"csrest_general.php",
"csrest_events.php",
"csrest_lists.php",
"csrest_people.php",
"csrest_segments.php",
"csrest_subscribers.php",
"csrest_templates.php",
"csrest_transactional_classicemail.php",
"csrest_transactional_smartemail.php",
"csrest_transactional_timeline.php",
"csrest_journeys.php",
"csrest_journey_emails.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Toby Brain",
"email": "tobio85@gmail.com",
"role": "Developer"
}
],
"description": "A php library which implements the complete functionality of the Campaign Monitor API.",
"homepage": "http://campaignmonitor.github.io/createsend-php/",
"keywords": [
"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
);
}