├── README.md ├── composer.json ├── composer.lock ├── index.php ├── mautic-functions.php ├── multi-instance.php ├── settings.php ├── vendor ├── autoload.php ├── composer │ ├── ClassLoader.php │ ├── LICENSE │ ├── autoload_classmap.php │ ├── autoload_namespaces.php │ ├── autoload_psr4.php │ ├── autoload_real.php │ ├── autoload_static.php │ └── installed.json ├── mautic │ └── api-library │ │ ├── .gitignore │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── apitester │ │ ├── endpoints │ │ │ ├── Assets.json │ │ │ ├── Campaigns.json │ │ │ ├── Companies.json │ │ │ ├── Contacts.json │ │ │ ├── Data.json │ │ │ ├── Emails.json │ │ │ ├── Focus.json │ │ │ ├── Forms.json │ │ │ ├── Notifications.json │ │ │ ├── Pages.json │ │ │ ├── Points.json │ │ │ ├── Reports.json │ │ │ ├── Segments.json │ │ │ ├── Smses.json │ │ │ ├── Stages.json │ │ │ └── Users.json │ │ ├── includes │ │ │ ├── bootstrap │ │ │ │ ├── css │ │ │ │ │ ├── bootstrap-theme.css │ │ │ │ │ ├── bootstrap-theme.css.map │ │ │ │ │ ├── bootstrap-theme.min.css │ │ │ │ │ ├── bootstrap.css │ │ │ │ │ ├── bootstrap.css.map │ │ │ │ │ └── bootstrap.min.css │ │ │ │ ├── fonts │ │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ └── glyphicons-halflings-regular.woff │ │ │ │ └── js │ │ │ │ │ ├── bootstrap.js │ │ │ │ │ └── bootstrap.min.js │ │ │ ├── jquery-1.11.1.min.js │ │ │ ├── style.css │ │ │ └── typeahead.js │ │ └── index.php │ │ ├── composer.json │ │ ├── lib │ │ ├── Api │ │ │ ├── Api.php │ │ │ ├── Assets.php │ │ │ ├── CampaignEvents.php │ │ │ ├── Campaigns.php │ │ │ ├── Categories.php │ │ │ ├── Companies.php │ │ │ ├── CompanyFields.php │ │ │ ├── ContactFields.php │ │ │ ├── Contacts.php │ │ │ ├── Data.php │ │ │ ├── Devices.php │ │ │ ├── DynamicContents.php │ │ │ ├── Emails.php │ │ │ ├── Files.php │ │ │ ├── Focus.php │ │ │ ├── Forms.php │ │ │ ├── Leads.php │ │ │ ├── Lists.php │ │ │ ├── Messages.php │ │ │ ├── Notes.php │ │ │ ├── Notifications.php │ │ │ ├── Pages.php │ │ │ ├── PointTriggers.php │ │ │ ├── Points.php │ │ │ ├── Reports.php │ │ │ ├── Roles.php │ │ │ ├── Segments.php │ │ │ ├── Smses.php │ │ │ ├── Stages.php │ │ │ ├── Stats.php │ │ │ ├── Tags.php │ │ │ ├── Themes.php │ │ │ ├── Tweets.php │ │ │ ├── Users.php │ │ │ └── Webhooks.php │ │ ├── Auth │ │ │ ├── AbstractAuth.php │ │ │ ├── ApiAuth.php │ │ │ ├── AuthInterface.php │ │ │ ├── BasicAuth.php │ │ │ └── OAuth.php │ │ ├── Exception │ │ │ ├── AbstractApiException.php │ │ │ ├── ActionNotSupportedException.php │ │ │ ├── AuthorizationRequiredException.php │ │ │ ├── ContextNotFoundException.php │ │ │ ├── IncorrectParametersReturnedException.php │ │ │ ├── RequiredParameterMissingException.php │ │ │ └── UnexpectedResponseFormatException.php │ │ ├── MauticApi.php │ │ ├── QueryBuilder │ │ │ ├── QueryBuilder.php │ │ │ └── WhereBuilder.php │ │ └── Response.php │ │ ├── phpunit.xml.dist │ │ └── tests │ │ ├── Api │ │ ├── AbstractCustomFieldsTest.php │ │ ├── AssetsTest.php │ │ ├── Auth │ │ │ ├── AbstractAuthTest.php │ │ │ └── BasicAuthTest.php │ │ ├── CampaignsTest.php │ │ ├── CategoriesTest.php │ │ ├── CompaniesTest.php │ │ ├── CompanyFieldsTest.php │ │ ├── ContactFieldsTest.php │ │ ├── ContactsTest.php │ │ ├── DataTest.php │ │ ├── DevicesTest.php │ │ ├── DynamicContentsTest.php │ │ ├── EmailsTest.php │ │ ├── ExceptionsTest.php │ │ ├── FilesTest.php │ │ ├── FocusTest.php │ │ ├── FormsTest.php │ │ ├── LeadsTest.php │ │ ├── ListsTest.php │ │ ├── MauticApiTestCase.php │ │ ├── MessagesTest.php │ │ ├── NotesTest.php │ │ ├── NotificationsTest.php │ │ ├── PagesTest.php │ │ ├── PointTriggersTest.php │ │ ├── PointsTest.php │ │ ├── ReportsTest.php │ │ ├── ResponseInfoTest.php │ │ ├── RolesTest.php │ │ ├── SegmentsTest.php │ │ ├── SmsesTest.php │ │ ├── StagesTest.php │ │ ├── StatsTest.php │ │ ├── TagsTest.php │ │ ├── ThemesTest.php │ │ ├── TweetsTest.php │ │ ├── UsersTest.php │ │ ├── UtmTagsTest.php │ │ └── WebhooksTest.php │ │ ├── QueryBuilder │ │ └── WhereBuilderTest.php │ │ ├── ResponseTest.php │ │ ├── bootstrap.php │ │ ├── local.config.php.dist │ │ └── mauticlogo.png └── psr │ └── log │ ├── .gitignore │ ├── LICENSE │ ├── Psr │ └── Log │ │ ├── AbstractLogger.php │ │ ├── InvalidArgumentException.php │ │ ├── LogLevel.php │ │ ├── LoggerAwareInterface.php │ │ ├── LoggerAwareTrait.php │ │ ├── LoggerInterface.php │ │ ├── LoggerTrait.php │ │ ├── NullLogger.php │ │ └── Test │ │ └── LoggerInterfaceTest.php │ ├── README.md │ └── composer.json └── woo-mautic-integration.php /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "mautic/api-library": "^2.10" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "hash": "9d0ac0393fe6cbb5dac9d0db45eb5aa8", 8 | "content-hash": "4feab46358b6310d50cacd402dd8f535", 9 | "packages": [ 10 | { 11 | "name": "mautic/api-library", 12 | "version": "2.12.0", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/mautic/api-library.git", 16 | "reference": "460f8fad5b4db89f2753777b16fa1d6ac3b1101e" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/mautic/api-library/zipball/460f8fad5b4db89f2753777b16fa1d6ac3b1101e", 21 | "reference": "460f8fad5b4db89f2753777b16fa1d6ac3b1101e", 22 | "shasum": "" 23 | }, 24 | "require": { 25 | "ext-curl": "*", 26 | "php": ">=5.3.7", 27 | "psr/log": "~1.0" 28 | }, 29 | "require-dev": { 30 | "phpunit/phpunit": "~4.8|~5.0", 31 | "raveren/kint": "~0.9" 32 | }, 33 | "type": "library", 34 | "autoload": { 35 | "psr-4": { 36 | "Mautic\\": "lib/" 37 | } 38 | }, 39 | "notification-url": "https://packagist.org/downloads/", 40 | "license": [ 41 | "MIT" 42 | ], 43 | "description": "Mautic API Connector Library", 44 | "time": "2018-02-27 12:51:34" 45 | }, 46 | { 47 | "name": "psr/log", 48 | "version": "1.0.2", 49 | "source": { 50 | "type": "git", 51 | "url": "https://github.com/php-fig/log.git", 52 | "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" 53 | }, 54 | "dist": { 55 | "type": "zip", 56 | "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", 57 | "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", 58 | "shasum": "" 59 | }, 60 | "require": { 61 | "php": ">=5.3.0" 62 | }, 63 | "type": "library", 64 | "extra": { 65 | "branch-alias": { 66 | "dev-master": "1.0.x-dev" 67 | } 68 | }, 69 | "autoload": { 70 | "psr-4": { 71 | "Psr\\Log\\": "Psr/Log/" 72 | } 73 | }, 74 | "notification-url": "https://packagist.org/downloads/", 75 | "license": [ 76 | "MIT" 77 | ], 78 | "authors": [ 79 | { 80 | "name": "PHP-FIG", 81 | "homepage": "http://www.php-fig.org/" 82 | } 83 | ], 84 | "description": "Common interface for logging libraries", 85 | "homepage": "https://github.com/php-fig/log", 86 | "keywords": [ 87 | "log", 88 | "psr", 89 | "psr-3" 90 | ], 91 | "time": "2016-10-10 12:19:37" 92 | } 93 | ], 94 | "packages-dev": [], 95 | "aliases": [], 96 | "minimum-stability": "stable", 97 | "stability-flags": [], 98 | "prefer-stable": false, 99 | "prefer-lowest": false, 100 | "platform": [], 101 | "platform-dev": [] 102 | } 103 | -------------------------------------------------------------------------------- /multi-instance.php: -------------------------------------------------------------------------------- 1 | array ( 60 | 61 | 'apiURL' => "https://localhost/mautic/ol/", 62 | 'userName' => 'woocommerce_ol', // Api user 63 | 'password' => 'password_ol', // Secure password 64 | 'sku_filter' => 'ol', 65 | 66 | ), 67 | 68 | 1 => array ( 69 | 70 | 'apiURL' => "https://localhost/mautic/xls/", 71 | 'userName' => 'woocommerce_xls', // Api user 72 | 'password' => 'password_xls', // Secure password 73 | 'sku_filter' => 'xls', 74 | 75 | ), 76 | 77 | 2 => array ( 78 | 79 | 'apiURL' => "https://localhost/mautic/1/", 80 | 'userName' => 'woocommerce_1', // Api user 81 | 'password' => 'password_1', // Secure password 82 | 'sku_filter' => '1', 83 | 84 | ), 85 | 86 | 3 => array ( 87 | 88 | 'apiURL' => "https://localhost/mautic/em/", 89 | 'userName' => 'woocommerce', // Api user 90 | 'password' => 'password', // Secure password 91 | 'sku_filter' => '', 92 | 93 | ), 94 | 95 | ); 96 | 97 | */ 98 | 99 | $mautic_instances = array ( 100 | 101 | ); -------------------------------------------------------------------------------- /settings.php: -------------------------------------------------------------------------------- 1 | ( get_option( 'mautic_woocommerce_settings_mautic_enable_forms' ) == 'yes' ) ? TRUE : FALSE, 12 | 'enable_api' => ( get_option( 'mautic_woocommerce_settings_mautic_enable_api' ) == 'yes' ) ? TRUE : FALSE, 13 | 'add_fields' => ( get_option( 'mautic_woocommerce_settings_mautic_add_fields' ) == 'yes' ) ? TRUE : FALSE, 14 | 'check_fields' => ( get_option( 'mautic_woocommerce_settings_mautic_check_fields' ) == 'yes' ) ? TRUE : FALSE, 15 | 'add_tags' => ( get_option( 'mautic_woocommerce_settings_mautic_add_tags' ) == 'yes' ) ? TRUE : FALSE, 16 | 'add_id_to_tags' => ( get_option( 'mautic_woocommerce_settings_mautic_add_id_to_tags' ) == 'yes' ) ? TRUE : FALSE, 17 | 'add_note' => ( get_option( 'mautic_woocommerce_settings_mautic_add_note' ) == 'yes' ) ? TRUE : FALSE, 18 | 'add_phone' => ( get_option( 'mautic_woocommerce_settings_mautic_add_phone' ) == 'yes' ) ? TRUE : FALSE, 19 | 'add_billing' => ( get_option( 'mautic_woocommerce_settings_mautic_add_billing' ) == 'yes' ) ? TRUE : FALSE, 20 | 'use_maxmind_location' => TRUE, // ( get_option( 'mautic_woocommerce_settings_mautic_use_maxmind_location' ) == 'yes' ) ? TRUE : FALSE, 21 | 'add_general_tags' => get_option( 'mautic_woocommerce_settings_mautic_add_general_tags' ), 22 | 'send_not_completed_orders' => ( get_option( 'mautic_woocommerce_settings_mautic_send_partial_statuses' ) == 'yes' ) ? TRUE : FALSE 23 | 24 | ); 25 | 26 | // MAUTIC BASIC API SETTINGS 27 | 28 | $basic_api_settings = array( 29 | 30 | 'apiURL' => get_option( 'mautic_woocommerce_settings_server' ), 31 | 'userName' => get_option( 'mautic_woocommerce_settings_mautic_username' ), 32 | 'password' => get_option( 'mautic_woocommerce_settings_mautic_password' ), 33 | 'sku_filter' => get_option( 'mautic_woocommerce_settings_mautic_sku_filter' ) 34 | 35 | ); 36 | 37 | $enable_multi_instance = FALSE; 38 | 39 | // var_dump($plugin_settings); 40 | // die(); 41 | 42 | 43 | -------------------------------------------------------------------------------- /vendor/autoload.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/psr/log/Psr/Log'), 10 | 'Mautic\\' => array($vendorDir . '/mautic/api-library/lib'), 11 | ); 12 | -------------------------------------------------------------------------------- /vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION'); 27 | if ($useStaticLoader) { 28 | require_once __DIR__ . '/autoload_static.php'; 29 | 30 | call_user_func(\Composer\Autoload\ComposerStaticInit7502dd8cccde5c5344ea09914cf0456c::getInitializer($loader)); 31 | } else { 32 | $map = require __DIR__ . '/autoload_namespaces.php'; 33 | foreach ($map as $namespace => $path) { 34 | $loader->set($namespace, $path); 35 | } 36 | 37 | $map = require __DIR__ . '/autoload_psr4.php'; 38 | foreach ($map as $namespace => $path) { 39 | $loader->setPsr4($namespace, $path); 40 | } 41 | 42 | $classMap = require __DIR__ . '/autoload_classmap.php'; 43 | if ($classMap) { 44 | $loader->addClassMap($classMap); 45 | } 46 | } 47 | 48 | $loader->register(true); 49 | 50 | return $loader; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | 11 | array ( 12 | 'Psr\\Log\\' => 8, 13 | ), 14 | 'M' => 15 | array ( 16 | 'Mautic\\' => 7, 17 | ), 18 | ); 19 | 20 | public static $prefixDirsPsr4 = array ( 21 | 'Psr\\Log\\' => 22 | array ( 23 | 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', 24 | ), 25 | 'Mautic\\' => 26 | array ( 27 | 0 => __DIR__ . '/..' . '/mautic/api-library/lib', 28 | ), 29 | ); 30 | 31 | public static function getInitializer(ClassLoader $loader) 32 | { 33 | return \Closure::bind(function () use ($loader) { 34 | $loader->prefixLengthsPsr4 = ComposerStaticInit7502dd8cccde5c5344ea09914cf0456c::$prefixLengthsPsr4; 35 | $loader->prefixDirsPsr4 = ComposerStaticInit7502dd8cccde5c5344ea09914cf0456c::$prefixDirsPsr4; 36 | 37 | }, null, ClassLoader::class); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vendor/composer/installed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "psr/log", 4 | "version": "1.0.2", 5 | "version_normalized": "1.0.2.0", 6 | "source": { 7 | "type": "git", 8 | "url": "https://github.com/php-fig/log.git", 9 | "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" 10 | }, 11 | "dist": { 12 | "type": "zip", 13 | "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", 14 | "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", 15 | "shasum": "" 16 | }, 17 | "require": { 18 | "php": ">=5.3.0" 19 | }, 20 | "time": "2016-10-10 12:19:37", 21 | "type": "library", 22 | "extra": { 23 | "branch-alias": { 24 | "dev-master": "1.0.x-dev" 25 | } 26 | }, 27 | "installation-source": "dist", 28 | "autoload": { 29 | "psr-4": { 30 | "Psr\\Log\\": "Psr/Log/" 31 | } 32 | }, 33 | "notification-url": "https://packagist.org/downloads/", 34 | "license": [ 35 | "MIT" 36 | ], 37 | "authors": [ 38 | { 39 | "name": "PHP-FIG", 40 | "homepage": "http://www.php-fig.org/" 41 | } 42 | ], 43 | "description": "Common interface for logging libraries", 44 | "homepage": "https://github.com/php-fig/log", 45 | "keywords": [ 46 | "log", 47 | "psr", 48 | "psr-3" 49 | ] 50 | }, 51 | { 52 | "name": "mautic/api-library", 53 | "version": "2.12.0", 54 | "version_normalized": "2.12.0.0", 55 | "source": { 56 | "type": "git", 57 | "url": "https://github.com/mautic/api-library.git", 58 | "reference": "460f8fad5b4db89f2753777b16fa1d6ac3b1101e" 59 | }, 60 | "dist": { 61 | "type": "zip", 62 | "url": "https://api.github.com/repos/mautic/api-library/zipball/460f8fad5b4db89f2753777b16fa1d6ac3b1101e", 63 | "reference": "460f8fad5b4db89f2753777b16fa1d6ac3b1101e", 64 | "shasum": "" 65 | }, 66 | "require": { 67 | "ext-curl": "*", 68 | "php": ">=5.3.7", 69 | "psr/log": "~1.0" 70 | }, 71 | "require-dev": { 72 | "phpunit/phpunit": "~4.8|~5.0", 73 | "raveren/kint": "~0.9" 74 | }, 75 | "time": "2018-02-27 12:51:34", 76 | "type": "library", 77 | "installation-source": "dist", 78 | "autoload": { 79 | "psr-4": { 80 | "Mautic\\": "lib/" 81 | } 82 | }, 83 | "notification-url": "https://packagist.org/downloads/", 84 | "license": [ 85 | "MIT" 86 | ], 87 | "description": "Mautic API Connector Library" 88 | } 89 | ] 90 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /.buildpath 3 | /.project 4 | /.settings 5 | /.phpintel 6 | /composer.lock 7 | /phpunit.xml 8 | /tests/local.config.php 9 | /tests/local.config.php_* 10 | /tests/local.tokens.php 11 | /tests/phpunit.phar 12 | /vendor 13 | .DS_Store 14 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Assets.json: -------------------------------------------------------------------------------- 1 | [ 2 | "assets", 3 | "assets/{id}", 4 | "assets/new", 5 | "assets/batch/new", 6 | "assets/batch/edit", 7 | "assets/batch/delete", 8 | "assets/{id}/edit", 9 | "assets/{id}/delete" 10 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Campaigns.json: -------------------------------------------------------------------------------- 1 | [ 2 | "campaigns", 3 | "campaigns/{id}", 4 | "campaigns/new", 5 | "campaigns/batch/new", 6 | "campaigns/batch/edit", 7 | "campaigns/batch/delete", 8 | "campaigns/{id}/edit", 9 | "campaigns/{id}/delete", 10 | "campaigns/{id}/contact/{contactId}/add", 11 | "campaigns/{id}/contact/{contactId}/remove", 12 | "campaigns/events", 13 | "campaigns/events/{id}", 14 | "campaigns/events/{eventId}/contact/{contactId}/edit", 15 | "campaigns/events/batch/edit" 16 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Companies.json: -------------------------------------------------------------------------------- 1 | [ 2 | "companies", 3 | "companies/{id}", 4 | "companies/new", 5 | "companies/batch/new", 6 | "companies/batch/edit", 7 | "companies/batch/delete", 8 | "companies/{id}/edit", 9 | "companies/{id}/delete", 10 | "companies/{id}/contact/{contactId}/add", 11 | "companies/{id}/contact/{contactId}/remove" 12 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Contacts.json: -------------------------------------------------------------------------------- 1 | [ 2 | "contacts", 3 | "contacts/{id}", 4 | "contacts/list/fields", 5 | "contacts/list/owners", 6 | "contacts/new", 7 | "contacts/batch/new", 8 | "contacts/batch/edit", 9 | "contacts/batch/delete", 10 | "contacts/{id}/edit", 11 | "contacts/{id}/delete", 12 | "contacts/{id}/notes", 13 | "contacts/{id}/segments", 14 | "contacts/{id}/campaigns", 15 | "contacts/{id}/points/plus/{points}", 16 | "contacts/{id}/points/minus/{points}", 17 | "contacts/{id}/points/times/{points}", 18 | "contacts/{id}/points/divide/{points}" 19 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Data.json: -------------------------------------------------------------------------------- 1 | [ 2 | "data", 3 | "data/{type}", 4 | ] 5 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Emails.json: -------------------------------------------------------------------------------- 1 | [ 2 | "emails", 3 | "emails/{id}", 4 | "emails/new", 5 | "emails/batch/new", 6 | "emails/batch/edit", 7 | "emails/batch/delete", 8 | "emails/{id}/edit", 9 | "emails/{id}/delete", 10 | "emails/{id}/send", 11 | "emails/{id}/contact/{contactId}/send" 12 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Focus.json: -------------------------------------------------------------------------------- 1 | [ 2 | "focus", 3 | "focus/{id}", 4 | "focus/new", 5 | "focus/batch/new", 6 | "focus/batch/edit", 7 | "focus/batch/delete", 8 | "focus/{id}/edit", 9 | "focus/{id}/delete" 10 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Forms.json: -------------------------------------------------------------------------------- 1 | [ 2 | "forms", 3 | "forms/{id}", 4 | "forms/new", 5 | "forms/batch/new", 6 | "forms/batch/edit", 7 | "forms/batch/delete", 8 | "forms/{id}/edit", 9 | "forms/{id}/delete" 10 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Notifications.json: -------------------------------------------------------------------------------- 1 | [ 2 | "smses", 3 | "smses/{id}", 4 | "smses/new", 5 | "smses/batch/new", 6 | "smses/batch/edit", 7 | "smses/batch/delete", 8 | "smses/{id}/edit", 9 | "smses/{id}/delete" 10 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Pages.json: -------------------------------------------------------------------------------- 1 | [ 2 | "pages", 3 | "pages/{id}", 4 | "pages/new", 5 | "pages/batch/new", 6 | "pages/batch/edit", 7 | "pages/batch/delete", 8 | "pages/{id}/edit", 9 | "pages/{id}/delete" 10 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Points.json: -------------------------------------------------------------------------------- 1 | [ 2 | "points", 3 | "points/{id}", 4 | "points/new", 5 | "points/batch/new", 6 | "points/batch/edit", 7 | "points/batch/delete", 8 | "points/{id}/edit", 9 | "points/{id}/delete", 10 | "points/triggers", 11 | "points/triggers/{id}", 12 | "points/triggers/new", 13 | "points/triggers/batch/new", 14 | "points/triggers/batch/edit", 15 | "points/triggers/batch/delete", 16 | "points/triggers/{id}/edit", 17 | "points/triggers/{id}/delete" 18 | ] 19 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Reports.json: -------------------------------------------------------------------------------- 1 | [ 2 | "reports", 3 | "reports/{id}" 4 | ] 5 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Segments.json: -------------------------------------------------------------------------------- 1 | [ 2 | "segments", 3 | "segments/new", 4 | "segments/batch/new", 5 | "segments/batch/edit", 6 | "segments/batch/delete", 7 | "segments/{id}/edit", 8 | "segments/{id}/delete", 9 | "segments/{id}/contact/{contactId}/add", 10 | "segments/{id}/contact/{contactId}/remove" 11 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Smses.json: -------------------------------------------------------------------------------- 1 | [ 2 | "notifications", 3 | "notifications/{id}", 4 | "notifications/new", 5 | "notifications/batch/new", 6 | "notifications/batch/edit", 7 | "notifications/batch/delete", 8 | "notifications/{id}/edit", 9 | "notifications/{id}/delete" 10 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Stages.json: -------------------------------------------------------------------------------- 1 | [ 2 | "stages", 3 | "stages/{id}", 4 | "stages/new", 5 | "stages/batch/new", 6 | "stages/batch/edit", 7 | "stages/batch/delete", 8 | "stages/{id}/edit", 9 | "stages/{id}/delete", 10 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/endpoints/Users.json: -------------------------------------------------------------------------------- 1 | [ 2 | "roles", 3 | "roles/{id}", 4 | "roles/new", 5 | "roles/batch/new", 6 | "roles/batch/edit", 7 | "roles/batch/delete", 8 | "roles/{id}/edit", 9 | "roles/{id}/delete", 10 | "users", 11 | "users/{id}", 12 | "users/new", 13 | "users/batch/new", 14 | "users/batch/edit", 15 | "users/batch/delete", 16 | "users/{id}/edit", 17 | "users/{id}/delete", 18 | "users/list/roles", 19 | "users/self", 20 | "users/{id}/permissioncheck" 21 | ] -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/includes/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxitromer/wootic/a253a50e1935f28658882bfd16ff3deb44439a6a/vendor/mautic/api-library/apitester/includes/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/includes/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxitromer/wootic/a253a50e1935f28658882bfd16ff3deb44439a6a/vendor/mautic/api-library/apitester/includes/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/includes/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxitromer/wootic/a253a50e1935f28658882bfd16ff3deb44439a6a/vendor/mautic/api-library/apitester/includes/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /vendor/mautic/api-library/apitester/includes/style.css: -------------------------------------------------------------------------------- 1 | .custom { 2 | -webkit-border-radius: 0px !important; 3 | -moz-border-radius: 0px !important; 4 | border-radius: 0px !important; 5 | } 6 | .custom-right { 7 | -webkit-border-radius: 4px 0px 0px 4px !important; 8 | -moz-border-radius: 4px 0px 0px 4px !important; 9 | border-radius: 4px 0px 0px 4px !important; 10 | width: 100%; 11 | } 12 | .parameter-row { 13 | margin-bottom: 3px; 14 | } 15 | .twitter-typeahead .tt-query, 16 | .twitter-typeahead .tt-hint { 17 | margin-bottom: 0; 18 | } 19 | .tt-hint { 20 | display: block; 21 | width: 100%; 22 | height: 38px; 23 | padding: 8px 12px 10px 12px; 24 | font-size: 14px; 25 | line-height: 1.428571429; 26 | color: #999; 27 | vertical-align: middle; 28 | background-color: #ffffff; 29 | border: 1px solid #cccccc; 30 | border-radius: 4px; 31 | -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); 32 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); 33 | -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; 34 | transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; 35 | } 36 | .tt-dropdown-menu { 37 | min-width: 160px; 38 | margin-top: 2px; 39 | padding: 5px 0; 40 | background-color: #ffffff; 41 | border: 1px solid #cccccc; 42 | border: 1px solid rgba(0, 0, 0, 0.15); 43 | border-radius: 4px; 44 | -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); 45 | box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); 46 | background-clip: padding-box; 47 | 48 | } 49 | .tt-suggestion { 50 | display: block; 51 | padding: 3px 20px; 52 | } 53 | .tt-suggestion.tt-is-under-cursor { 54 | color: #fff; 55 | background-color: #428bca; 56 | } 57 | .tt-suggestion.tt-is-under-cursor a { 58 | color: #fff; 59 | } 60 | .tt-suggestion p { 61 | margin: 0; 62 | } 63 | .twitter-typeahead { width: 100%; } 64 | 65 | .endpoint-name { 66 | margin: 0 20px 5px 20px; 67 | padding: 3px 0; 68 | border-bottom: 1px solid #ccc; 69 | } 70 | 71 | #scrollable-dropdown-menu .tt-dropdown-menu { 72 | max-height: 150px; 73 | overflow-y: auto; 74 | } -------------------------------------------------------------------------------- /vendor/mautic/api-library/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mautic/api-library", 3 | "license": "MIT", 4 | "type": "library", 5 | "description": "Mautic API Connector Library", 6 | "autoload": { 7 | "psr-4": { 8 | "Mautic\\": "lib/" 9 | } 10 | }, 11 | "autoload-dev": { 12 | "psr-4": { 13 | "Mautic\\Tests\\": "tests/" 14 | } 15 | }, 16 | "require": { 17 | "php": ">=5.3.7", 18 | "ext-curl": "*", 19 | "psr/log": "~1.0" 20 | }, 21 | "require-dev": { 22 | "raveren/kint": "~0.9", 23 | "phpunit/phpunit": "~4.8|~5.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Assets.php: -------------------------------------------------------------------------------- 1 | $search, 57 | 'start' => $start, 58 | 'limit' => $limit, 59 | 'orderBy' => $orderBy, 60 | 'orderByDir' => $orderByDir, 61 | ); 62 | 63 | $parameters = array_filter($parameters); 64 | 65 | return $this->makeRequest($this->endpoint.'/contact/'.$contactId, $parameters); 66 | } 67 | 68 | /** 69 | * Get contact events for a single campaign 70 | * 71 | * @param $campaignId 72 | * @param $contactId 73 | * @param string $search 74 | * @param int $start 75 | * @param int $limit 76 | * @param string $orderBy 77 | * @param string $orderByDir 78 | * 79 | * @return array|mixed 80 | */ 81 | public function getContactCampaignEvents($campaignId, $contactId, $search = '', $start = 0, $limit = 0, $orderBy = '', $orderByDir = 'ASC') 82 | { 83 | $parameters = array( 84 | 'search' => $search, 85 | 'start' => $start, 86 | 'limit' => $limit, 87 | 'orderBy' => $orderBy, 88 | 'orderByDir' => $orderByDir, 89 | ); 90 | 91 | $parameters = array_filter($parameters); 92 | 93 | return $this->makeRequest('campaigns/'.$campaignId.'/events/contact/'.$contactId, $parameters); 94 | } 95 | 96 | /** 97 | * Edit or schedule a campaign event for a specific contact. 98 | * 99 | * @param $contactId 100 | * @param $eventId 101 | * @param $parameters 102 | * 103 | * @return array|mixed 104 | */ 105 | public function editContactEvent($contactId, $eventId, array $parameters) 106 | { 107 | return $this->makeRequest($this->endpoint.'/'.$eventId.'/contact/'.$contactId.'/edit', $parameters, 'PUT'); 108 | } 109 | 110 | /** 111 | * Edit or schedule multiple events 112 | * 113 | * @param array $parameters 114 | * 115 | * @return array|mixed 116 | */ 117 | public function editEvents(array $parameters) 118 | { 119 | return $this->makeRequest($this->endpoint.'/batch/edit', $parameters, 'PUT'); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Campaigns.php: -------------------------------------------------------------------------------- 1 | 'campaigns/$1/contact/add/$2', // 2.6.0 38 | 'campaigns/(.*?)/contact/(.*?)/remove' => 'campaigns/$1/contact/remove/$2' // 2.6.0 39 | ); 40 | 41 | /** 42 | * {@inheritdoc} 43 | */ 44 | protected $searchCommands = array( 45 | 'ids', 46 | 'is:published', 47 | 'is:unpublished', 48 | 'is:mine', 49 | 'is:uncategorized', 50 | 'category', 51 | ); 52 | 53 | /** 54 | * Add a lead to the campaign 55 | * 56 | * @deprecated 2.0.1, use addContact instead 57 | * 58 | * @param int $id Campaign ID 59 | * @param int $leadId Lead ID 60 | * 61 | * @return array|mixed 62 | */ 63 | public function addLead($id, $leadId) 64 | { 65 | return $this->addContact($id, $leadId); 66 | } 67 | 68 | /** 69 | * Add a contact to the campaign 70 | * 71 | * @param int $id Campaign ID 72 | * @param int $contactId Contact ID 73 | * 74 | * @return array|mixed 75 | */ 76 | public function addContact($id, $contactId) 77 | { 78 | return $this->makeRequest($this->endpoint.'/'.$id.'/contact/'.$contactId.'/add', array(), 'POST'); 79 | } 80 | 81 | /** 82 | * Remove a lead from the campaign 83 | * 84 | * @deprecated 2.0.1, use removeContact instead 85 | * 86 | * @param int $id Campaign ID 87 | * @param int $leadId Lead ID 88 | * 89 | * @return array|mixed 90 | */ 91 | public function removeLead($id, $leadId) 92 | { 93 | return $this->removeContact($id, $leadId); 94 | } 95 | 96 | /** 97 | * Remove a contact from the campaign 98 | * 99 | * @param int $id Campaign ID 100 | * @param int $contactId Contact ID 101 | * 102 | * @return array|mixed 103 | */ 104 | public function removeContact($id, $contactId) 105 | { 106 | return $this->makeRequest($this->endpoint.'/'.$id.'/contact/'.$contactId.'/remove', array(), 'POST'); 107 | } 108 | 109 | /** 110 | * Get a list of stat items 111 | * 112 | * @param int $id Campaign ID 113 | * @param int $start 114 | * @param int $limit 115 | * @param array $order 116 | * @param array $where 117 | * 118 | * @return array|mixed 119 | */ 120 | public function getContacts($id, $start = 0, $limit = 0, array $order = array(), array $where = array()) 121 | { 122 | $parameters = array(); 123 | $args = array('start', 'limit', 'order', 'where'); 124 | 125 | foreach ($args as $arg) { 126 | if (!empty($$arg)) { 127 | $parameters[$arg] = $$arg; 128 | } 129 | } 130 | 131 | return $this->makeRequest($this->endpoint.'/'.$id.'/contacts', $parameters); 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Categories.php: -------------------------------------------------------------------------------- 1 | 'companies/$1/contact/add/$2', // 2.6.0 38 | 'companies/(.*?)/contact/(.*?)/remove' => 'companies/$1/contact/remove/$2' // 2.6.0 39 | ); 40 | 41 | /** 42 | * {@inheritdoc} 43 | */ 44 | protected $searchCommands = array( 45 | 'ids', 46 | 'is:mine', 47 | ); 48 | 49 | /** 50 | * Add a contact to the company 51 | * 52 | * @param int $id Company ID 53 | * @param int $contactId Contact ID 54 | * 55 | * @return array|mixed 56 | */ 57 | public function addContact($id, $contactId) 58 | { 59 | return $this->makeRequest($this->endpoint.'/'.$id.'/contact/'.$contactId.'/add', array(), 'POST'); 60 | } 61 | 62 | /** 63 | * Remove a contact from the company 64 | * 65 | * @param int $id Company ID 66 | * @param int $contactId Contact ID 67 | * 68 | * @return array|mixed 69 | */ 70 | public function removeContact($id, $contactId) 71 | { 72 | return $this->makeRequest($this->endpoint.'/'.$id.'/contact/'.$contactId.'/remove', array(), 'POST'); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/CompanyFields.php: -------------------------------------------------------------------------------- 1 | makeRequest("{$this->endpoint}/$id", $options); 44 | } 45 | 46 | /** 47 | * {@inheritdoc} 48 | */ 49 | public function getPublishedList($search = '', $start = 0, $limit = 0, $orderBy = '', $orderByDir = 'ASC') 50 | { 51 | return $this->actionNotSupported(__FUNCTION__); 52 | } 53 | 54 | /** 55 | * {@inheritdoc} 56 | */ 57 | public function create(array $parameters) 58 | { 59 | return $this->actionNotSupported(__FUNCTION__); 60 | } 61 | 62 | /** 63 | * {@inheritdoc} 64 | */ 65 | public function edit($id, array $parameters, $createIfNotExists = false) 66 | { 67 | return $this->actionNotSupported(__FUNCTION__); 68 | } 69 | 70 | /** 71 | * {@inheritdoc} 72 | */ 73 | public function delete($id) 74 | { 75 | return $this->actionNotSupported(__FUNCTION__); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Devices.php: -------------------------------------------------------------------------------- 1 | 'emails/$1/send/contact/$2', // 2.6.0 38 | ); 39 | 40 | /** 41 | * {@inheritdoc} 42 | */ 43 | protected $searchCommands = array( 44 | 'ids', 45 | 'is:published', 46 | 'is:unpublished', 47 | 'is:mine', 48 | 'is:uncategorized', 49 | 'category', 50 | 'lang', 51 | ); 52 | 53 | 54 | /** 55 | * Send email to the assigned lists 56 | * 57 | * @param int $id 58 | * 59 | * @return array|mixed 60 | */ 61 | public function send($id) 62 | { 63 | return $this->makeRequest($this->endpoint.'/'.$id.'/send', array(), 'POST'); 64 | } 65 | 66 | /** 67 | * Send email to a specific contact 68 | * 69 | * @param int $id 70 | * @param int $contactId 71 | * 72 | * @return array|mixed 73 | */ 74 | public function sendToContact($id, $contactId, $parameters = array()) 75 | { 76 | return $this->makeRequest($this->endpoint.'/'.$id.'/contact/'.$contactId.'/send', $parameters, 'POST'); 77 | } 78 | 79 | /** 80 | * Send email to a specific lead 81 | * 82 | * @deprecated use sendToContact instead 83 | * 84 | * @param int $id 85 | * @param int $leadId 86 | * 87 | * @return array|mixed 88 | */ 89 | public function sendToLead($id, $leadId) 90 | { 91 | return $this->sendToContact($id, $leadId); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Files.php: -------------------------------------------------------------------------------- 1 | endpoint = 'files/'.$folder; 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | */ 47 | public function edit($id, array $parameters, $createIfNotExists = false) 48 | { 49 | return $this->actionNotSupported('edit'); 50 | } 51 | 52 | /** 53 | * @param array $parameters 54 | * 55 | * @return array|mixed 56 | */ 57 | public function create(array $parameters) 58 | { 59 | if (!isset($parameters['file'])) { 60 | throw new \InvalidArgumentException('file must be set in parameters'); 61 | } 62 | 63 | return parent::create($parameters); 64 | } 65 | 66 | /** 67 | * {@inheritdoc} 68 | */ 69 | public function createBatch(array $parameters) 70 | { 71 | return $this->actionNotSupported('createBatch'); 72 | } 73 | 74 | /** 75 | * {@inheritdoc} 76 | */ 77 | public function editBatch(array $parameters, $createIfNotExists = false) 78 | { 79 | return $this->actionNotSupported('editBatch'); 80 | } 81 | 82 | /** 83 | * {@inheritdoc} 84 | */ 85 | public function deleteBatch(array $ids) 86 | { 87 | return $this->actionNotSupported('deleteBatch'); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Focus.php: -------------------------------------------------------------------------------- 1 | makeRequest($this->endpoint.'/'.$formId.'/fields/delete', array('fields' => $fieldIds), 'DELETE'); 58 | } 59 | 60 | /** 61 | * Remove actions from a form 62 | * 63 | * @param integer $formId 64 | * @param array $actionIds 65 | * 66 | * @return array|mixed 67 | */ 68 | public function deleteActions($formId, array $actionIds) 69 | { 70 | return $this->makeRequest($this->endpoint.'/'.$formId.'/actions/delete', array('actions' => $actionIds), 'DELETE'); 71 | } 72 | 73 | /** 74 | * Get a single submission 75 | * 76 | * @param int $formId 77 | * @param int $submissionId 78 | * 79 | * @return array|mixed 80 | */ 81 | public function getSubmission($formId, $submissionId) 82 | { 83 | return $this->makeRequest("{$this->endpoint}/$formId/submissions/$submissionId"); 84 | } 85 | 86 | /** 87 | * Get a list of form submissions 88 | * 89 | * @param int $formId 90 | * @param string $search 91 | * @param int $start 92 | * @param int $limit 93 | * @param string $orderBy 94 | * @param string $orderByDir 95 | * @param bool $publishedOnly 96 | * @param bool $minimal 97 | * 98 | * @return array|mixed 99 | */ 100 | public function getSubmissions($formId, $search = '', $start = 0, $limit = 0, $orderBy = '', $orderByDir = 'ASC', $publishedOnly = false, $minimal = false) 101 | { 102 | $parameters = array( 103 | 'search' => $search, 104 | 'start' => $start, 105 | 'limit' => $limit, 106 | 'orderBy' => $orderBy, 107 | 'orderByDir' => $orderByDir, 108 | 'publishedOnly' => $publishedOnly, 109 | 'minimal' => $minimal 110 | ); 111 | 112 | $parameters = array_filter($parameters); 113 | 114 | return $this->makeRequest("{$this->endpoint}/$formId/submissions", $parameters); 115 | } 116 | 117 | /** 118 | * Get a list of form submissions for specific form and contact 119 | * 120 | * @param int $formId 121 | * @param int $contactId 122 | * @param string $search 123 | * @param int $start 124 | * @param int $limit 125 | * @param string $orderBy 126 | * @param string $orderByDir 127 | * @param bool $publishedOnly 128 | * @param bool $minimal 129 | * 130 | * @return array|mixed 131 | */ 132 | public function getSubmissionsForContact($formId, $contactId, $search = '', $start = 0, $limit = 0, $orderBy = '', $orderByDir = 'ASC', $publishedOnly = false, $minimal = false) 133 | { 134 | $parameters = array( 135 | 'search' => $search, 136 | 'start' => $start, 137 | 'limit' => $limit, 138 | 'orderBy' => $orderBy, 139 | 'orderByDir' => $orderByDir, 140 | 'publishedOnly' => $publishedOnly, 141 | 'minimal' => $minimal 142 | ); 143 | 144 | $parameters = array_filter($parameters); 145 | 146 | return $this->makeRequest("{$this->endpoint}/$formId/submissions/contact/$contactId", $parameters); 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Leads.php: -------------------------------------------------------------------------------- 1 | makeRequest('contacts/list/segments'); 29 | } 30 | 31 | /** 32 | * @param $id 33 | * @param string $search 34 | * @param int $start 35 | * @param int $limit 36 | * @param string $orderBy 37 | * @param string $orderByDir 38 | * 39 | * @return array|mixed 40 | */ 41 | public function getLeadNotes($id, $search = '', $start = 0, $limit = 0, $orderBy = '', $orderByDir = 'ASC') 42 | { 43 | $parameters = array( 44 | 'search' => $search, 45 | 'start' => $start, 46 | 'limit' => $limit, 47 | 'orderBy' => $orderBy, 48 | 'orderByDir' => $orderByDir, 49 | ); 50 | 51 | $parameters = array_filter($parameters); 52 | 53 | return $this->makeRequest('contacts/'.$id.'/notes', $parameters); 54 | } 55 | 56 | /** 57 | * @param $id 58 | * 59 | * @return array|mixed 60 | */ 61 | public function getLeadLists($id) 62 | { 63 | return $this->makeRequest('contacts/'.$id.'/segments'); 64 | } 65 | 66 | /** 67 | * @param $id 68 | * 69 | * @return array|mixed 70 | */ 71 | public function getLeadCampaigns($id) 72 | { 73 | return $this->makeRequest('contacts/'.$id.'/campaigns'); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Lists.php: -------------------------------------------------------------------------------- 1 | makeRequest($this->endpoint.'/'.$id.'/contact/add/'.$leadId, array(), 'POST'); 36 | } 37 | 38 | 39 | /** 40 | * Remove a lead from the list 41 | * 42 | * @param int $id List ID 43 | * @param int $leadId Lead ID 44 | * 45 | * @return array|mixed 46 | */ 47 | public function removeLead($id, $leadId) 48 | { 49 | return $this->makeRequest($this->endpoint.'/'.$id.'/contact/remove/'.$leadId, array(), 'POST'); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Messages.php: -------------------------------------------------------------------------------- 1 | makeRequest($this->endpoint.'/'.$triggerId.'/events/delete', array('events' => $eventIds), 'DELETE'); 51 | } 52 | 53 | /** 54 | * Get list of available event types 55 | * 56 | * @return array|mixed 57 | */ 58 | public function getEventTypes() 59 | { 60 | return $this->makeRequest($this->endpoint.'/events/types'); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Points.php: -------------------------------------------------------------------------------- 1 | makeRequest($this->endpoint.'/actions/types'); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Reports.php: -------------------------------------------------------------------------------- 1 | 'segments/$1/contact/add/$2', // 2.6.0 38 | 'segments/(.*?)/contact/(.*?)/remove' => 'segments/$1/contact/remove/$2', // 2.6.0 39 | ); 40 | 41 | /** 42 | * Add a contact to the segment 43 | * 44 | * @param int $segmentId Segment ID 45 | * @param int $contactId Contact ID 46 | * 47 | * @return array|mixed 48 | */ 49 | public function addContact($segmentId, $contactId) 50 | { 51 | return $this->makeRequest($this->endpoint.'/'.$segmentId.'/contact/'.$contactId.'/add', array(), 'POST'); 52 | } 53 | 54 | /** 55 | * Add a lead to the segment 56 | * 57 | * @deprecated 2.0.1, use addContact() instead 58 | * 59 | * @param int $id Segment ID 60 | * @param int $leadId Lead ID 61 | * 62 | * @return array|mixed 63 | */ 64 | public function addLead($id, $leadId) 65 | { 66 | return $this->addContact($id, $leadId); 67 | } 68 | 69 | /** 70 | * Remove a contact from the segment 71 | * 72 | * @param int $segmentId Segment ID 73 | * @param int $contactId Contact ID 74 | * 75 | * @return array|mixed 76 | */ 77 | public function removeContact($segmentId, $contactId) 78 | { 79 | return $this->makeRequest($this->endpoint.'/'.$segmentId.'/contact/'.$contactId.'/remove', array(), 'POST'); 80 | } 81 | 82 | /** 83 | * Remove a lead from the segment 84 | * 85 | * @deprecated 2.0.1, use addContact() instead 86 | * 87 | * @param int $id Segment ID 88 | * @param int $leadId Lead ID 89 | * 90 | * @return array|mixed 91 | */ 92 | public function removeLead($id, $leadId) 93 | { 94 | return $this->removeContact($id, $leadId); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Smses.php: -------------------------------------------------------------------------------- 1 | 'stages/$1/contact/add/$2', // 2.6.0 35 | 'stages/(.*?)/contact/(.*?)/remove' => 'stages/$1/contact/remove/$2', // 2.6.0 36 | ); 37 | 38 | /** 39 | * {@inheritdoc} 40 | */ 41 | protected $searchCommands = array( 42 | 'ids', 43 | ); 44 | 45 | /** 46 | * Add a contact to the stage 47 | * 48 | * @param int $id Stage ID 49 | * @param int $contactId Contact ID 50 | * 51 | * @return array|mixed 52 | */ 53 | public function addContact($id, $contactId) 54 | { 55 | return $this->makeRequest($this->endpoint.'/'.$id.'/contact/'.$contactId.'/add', array(), 'POST'); 56 | } 57 | 58 | /** 59 | * Remove a contact from the stage 60 | * 61 | * @param int $id Stage ID 62 | * @param int $contactId Contact ID 63 | * 64 | * @return array|mixed 65 | */ 66 | public function removeContact($id, $contactId) 67 | { 68 | return $this->makeRequest($this->endpoint.'/'.$id.'/contact/'.$contactId.'/remove', array(), 'POST'); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Stats.php: -------------------------------------------------------------------------------- 1 | $start, 43 | 'limit' => $limit, 44 | 'order' => $order, 45 | 'where' => $where, 46 | ); 47 | 48 | $parameters = array_filter($parameters); 49 | 50 | return $this->makeRequest($this->endpoint.'/'.$table, $parameters); 51 | } 52 | 53 | /** 54 | * {@inheritdoc} 55 | */ 56 | public function delete($id) 57 | { 58 | return $this->actionNotSupported('delete'); 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getList($search = '', $start = 0, $limit = 0, $orderBy = '', $orderByDir = 'ASC', $publishedOnly = false, $minimal = false) 65 | { 66 | return $this->actionNotSupported('getList'); 67 | } 68 | 69 | /** 70 | * {@inheritdoc} 71 | */ 72 | public function create(array $parameters) 73 | { 74 | return $this->actionNotSupported('create'); 75 | } 76 | 77 | /** 78 | * {@inheritdoc} 79 | */ 80 | public function getPublishedList($search = '', $start = 0, $limit = 0, $orderBy = '', $orderByDir = 'ASC') 81 | { 82 | return $this->actionNotSupported('getPublishedList'); 83 | } 84 | 85 | /** 86 | * {@inheritdoc} 87 | */ 88 | public function edit($id, array $parameters, $createIfNotExists = false) 89 | { 90 | return $this->actionNotSupported('edit'); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Tags.php: -------------------------------------------------------------------------------- 1 | actionNotSupported('edit'); 42 | } 43 | 44 | /** 45 | * @param array $parameters 46 | * 47 | * @return array|mixed 48 | */ 49 | public function create(array $parameters) 50 | { 51 | if (!isset($parameters['file'])) { 52 | throw new \InvalidArgumentException('theme zip file must be set in parameters'); 53 | } 54 | 55 | return parent::create($parameters); 56 | } 57 | 58 | /** 59 | * {@inheritdoc} 60 | */ 61 | public function createBatch(array $parameters) 62 | { 63 | return $this->actionNotSupported('createBatch'); 64 | } 65 | 66 | /** 67 | * {@inheritdoc} 68 | */ 69 | public function editBatch(array $parameters, $createIfNotExists = false) 70 | { 71 | return $this->actionNotSupported('editBatch'); 72 | } 73 | 74 | /** 75 | * {@inheritdoc} 76 | */ 77 | public function deleteBatch(array $ids) 78 | { 79 | return $this->actionNotSupported('deleteBatch'); 80 | } 81 | 82 | /** 83 | * @return null 84 | */ 85 | public function getTemporaryFilepath() 86 | { 87 | return $this->temporaryFilePath ?: sys_get_temp_dir(); 88 | } 89 | 90 | /** 91 | * @param null $temporaryFilePath 92 | */ 93 | public function setTemporaryFilePath($temporaryFilePath) 94 | { 95 | $this->temporaryFilePath = $temporaryFilePath; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Tweets.php: -------------------------------------------------------------------------------- 1 | makeRequest($this->endpoint.'/self'); 56 | } 57 | 58 | /** 59 | * Get list of permissions for a user 60 | * 61 | * @param int $id 62 | * @param string|array $permissions 63 | * 64 | * @return array|mixed 65 | */ 66 | public function checkPermission($id, $permissions) 67 | { 68 | return $this->makeRequest($this->endpoint.'/'.$id.'/permissioncheck', array('permissions' => $permissions), 'POST'); 69 | } 70 | } -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Api/Webhooks.php: -------------------------------------------------------------------------------- 1 | makeRequest($this->endpoint.'/triggers'); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Auth/ApiAuth.php: -------------------------------------------------------------------------------- 1 | newAuth($parameters, $authMethod); 34 | } 35 | 36 | /** 37 | * Get an API Auth object 38 | * 39 | * @param array $parameters 40 | * @param string $authMethod 41 | * 42 | * @return AuthInterface 43 | */ 44 | public function newAuth($parameters = array(), $authMethod = 'OAuth') 45 | { 46 | $class = 'Mautic\\Auth\\'.$authMethod; 47 | $authObject = new $class(); 48 | 49 | $reflection = new \ReflectionMethod($class, 'setup'); 50 | $pass = array(); 51 | 52 | foreach ($reflection->getParameters() as $param) { 53 | if (isset($parameters[$param->getName()])) { 54 | $pass[] = $parameters[$param->getName()]; 55 | } else { 56 | $pass[] = null; 57 | } 58 | } 59 | 60 | $reflection->invokeArgs($authObject, $pass); 61 | 62 | return $authObject; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Auth/AuthInterface.php: -------------------------------------------------------------------------------- 1 | newAuth() will accept an array of Auth settings 20 | | $settings = array( 21 | | 'AuthMethod' => 'BasicAuth' // Must be one of 'OAuth' or 'BasicAuth' 22 | | 'userName' => '', // The username for authentication; Best practise would be to set up a new user for each external site 23 | | 'password' => '', // Make this a Long passPhrase e.g. (Try.!wE4.And.*@ws4.Guess.!a4911.This.*-+1.Sucker.!) 24 | | 'apiUrl' => '', // NOTE: Required for Unit tests; *must* contain a valid url 25 | | ); 26 | | 27 | | // Initiate the auth object 28 | | $initAuth = new ApiAuth(); 29 | | $auth = $initAuth->newAuth($settings, $settings['AuthMethod']); 30 | | 31 | |-------------------------------------------------------------------------- 32 | | Basic API Usage 33 | |-------------------------------------------------------------------------- 34 | | 35 | | To use, just pass the auth object to the Api context you are creating. 36 | | 37 | | use Mautic\MauticApi; 38 | | 39 | | // Get a Contact context 40 | | $api = new MauticApi(); 41 | | $contactApi = $api->newApi('contacts', $auth, $settings['apiUrl']); 42 | | 43 | | // Get Contact list 44 | | $results = $contactApi->getList(); 45 | | 46 | | Note: If the credentials are incorrect an error response will be returned: 47 | | array('error' => array( 48 | | 'code' => 403, 49 | | 'message' => 'access_denied: OAuth2 authentication required' ) 50 | | ) 51 | | 52 | */ 53 | 54 | namespace Mautic\Auth; 55 | 56 | use Mautic\Exception\RequiredParameterMissingException; 57 | 58 | /** 59 | * Basic Authentication Client mashed together by MarkLL 60 | */ 61 | class BasicAuth extends AbstractAuth 62 | { 63 | /** 64 | * Password associated with Username 65 | * 66 | * @var string 67 | */ 68 | private $password; 69 | 70 | /** 71 | * Username or email, basically the Login Identifier 72 | * 73 | * @var string 74 | */ 75 | private $userName; 76 | 77 | /** 78 | * {@inheritdoc} 79 | */ 80 | public function isAuthorized() 81 | { 82 | return (!empty($this->userName) && !empty($this->password)); 83 | } 84 | 85 | /** 86 | * @param string $userName The username to use for Authentication *Required* 87 | * @param string $password The Password to use *Required* 88 | * 89 | * @throws RequiredParameterMissingException 90 | */ 91 | public function setup($userName, $password) { 92 | // we MUST have the username and password. No Blanks allowed! 93 | // 94 | // remove blanks else Empty doesn't work 95 | $userName = trim($userName); 96 | $password = trim($password); 97 | 98 | if (empty($userName) || empty($password)) { 99 | //Throw exception if the required parameters were not found 100 | $this->log('parameters did not include username and/or password'); 101 | throw new RequiredParameterMissingException('One or more required parameters was not supplied. Both userName and password required!'); 102 | } 103 | 104 | $this->userName = $userName; 105 | $this->password = $password; 106 | } 107 | 108 | /** 109 | * @param $url 110 | * @param array $headers 111 | * @param array $parameters 112 | * @param $method 113 | * @param array $settings 114 | * 115 | * @return array 116 | */ 117 | protected function prepareRequest($url, array $headers, array $parameters, $method, array $settings) 118 | { 119 | //Set Basic Auth parameters/headers 120 | $headers = array_merge($headers, array($this->buildAuthorizationHeader(), 'Expect:')); 121 | 122 | return array($headers, $parameters); 123 | } 124 | 125 | /** 126 | * Build header for Basic Authentication 127 | * 128 | * @return string 129 | */ 130 | private function buildAuthorizationHeader() 131 | { 132 | /* 133 | |-------------------------------------------------------------------------- 134 | | Authorization Header 135 | |-------------------------------------------------------------------------- 136 | | 137 | | Authorization is passed in the Header using Basic Authentication. 138 | | 139 | | Basically we take the username and password and seperate it with a 140 | | colon (:) and base 64 encode it: 141 | | 142 | | 'Authorization: Basic username:password' 143 | | 144 | | ==> with base64 encoding of the username and password 145 | | 146 | | 'Authorization: Basic dXNlcjpwYXNzd29yZA==' 147 | | 148 | */ 149 | return 'Authorization: Basic ' . base64_encode($this->userName.':'.$this->password); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Exception/AbstractApiException.php: -------------------------------------------------------------------------------- 1 | authUrl = $authUrl; 29 | } 30 | 31 | /** 32 | * @return string 33 | */ 34 | public function getAuthUrl() 35 | { 36 | return $this->authUrl; 37 | } 38 | } -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Exception/ContextNotFoundException.php: -------------------------------------------------------------------------------- 1 | response = $response; 35 | 36 | if (empty($message)) { 37 | // Use message appropriate to the subclass with late binding 38 | $message = self::DEFAULT_MESSAGE; 39 | } 40 | 41 | $message .= "\n\nResponse: "; 42 | 43 | // Attach first 1000 characters of the body 44 | if (mb_strlen($response->getBody()) > 1000) { 45 | $message .= mb_substr($response->getBody(), 0, 1000).'...'; 46 | } else { 47 | $message .= $response->getBody(); 48 | } 49 | 50 | parent::__construct($message, $code, $previous); 51 | } 52 | 53 | /** 54 | * @return Response 55 | */ 56 | public function getResponse() 57 | { 58 | return $this->response; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/MauticApi.php: -------------------------------------------------------------------------------- 1 | select[] = $column; 42 | } 43 | 44 | /** 45 | * @param $column 46 | * @param string $dir 47 | */ 48 | public function addOrder($column, $dir = 'asc') 49 | { 50 | $this->order[] = array( 51 | 'col' => $column, 52 | 'dir' => $dir 53 | ); 54 | } 55 | 56 | /** 57 | * @param WhereBuilder $whereBuilder 58 | */ 59 | public function addWhere(WhereBuilder $whereBuilder = null) 60 | { 61 | if (null === $whereBuilder) { 62 | if (null === self::$whereBuilder) { 63 | return; 64 | } 65 | 66 | $whereBuilder = self::$whereBuilder; 67 | } 68 | 69 | $this->where = array_merge($this->where, $whereBuilder->getClauses()); 70 | 71 | $this->resetWhereBuilder(); 72 | } 73 | 74 | /** 75 | * @param bool $new 76 | * 77 | * @return WhereBuilder 78 | */ 79 | public function getWhereBuilder($new = false) 80 | { 81 | if ($new) { 82 | return new WhereBuilder(); 83 | } 84 | 85 | if (null == self::$whereBuilder) { 86 | $this->resetWhereBuilder(); 87 | } 88 | 89 | return self::$whereBuilder; 90 | } 91 | 92 | /** 93 | * @return WhereBuilder 94 | */ 95 | public function expr() 96 | { 97 | return $this->getWhereBuilder(true); 98 | } 99 | 100 | /** 101 | * @return array 102 | */ 103 | public function getSelect() 104 | { 105 | return $this->select; 106 | } 107 | 108 | /** 109 | * @param array $select 110 | * 111 | * @return QueryBuilder 112 | */ 113 | public function setSelect($select) 114 | { 115 | $this->select = $select; 116 | 117 | return $this; 118 | } 119 | 120 | /** 121 | * @return array 122 | */ 123 | public function getOrder() 124 | { 125 | return $this->order; 126 | } 127 | 128 | /** 129 | * @param array $order 130 | * 131 | * @return QueryBuilder 132 | */ 133 | public function setOrder($order) 134 | { 135 | $this->order = $order; 136 | 137 | return $this; 138 | } 139 | 140 | /** 141 | * @return array 142 | */ 143 | public function getWhere() 144 | { 145 | // Add clauses from static::$whereBuilder 146 | $this->addWhere(); 147 | 148 | return $this->where; 149 | } 150 | 151 | /** 152 | * @param array $where 153 | * 154 | * @return QueryBuilder 155 | */ 156 | public function setWhere($where) 157 | { 158 | $this->where = $where; 159 | 160 | return $this; 161 | } 162 | 163 | 164 | protected function resetWhereBuilder() 165 | { 166 | self::$whereBuilder = new WhereBuilder(); 167 | } 168 | } -------------------------------------------------------------------------------- /vendor/mautic/api-library/lib/Response.php: -------------------------------------------------------------------------------- 1 | info = $info; 30 | $this->parseResponse($response); 31 | $this->validate(); 32 | } 33 | 34 | /** 35 | * @return array 36 | */ 37 | public function getHeaders() 38 | { 39 | return $this->headers; 40 | } 41 | 42 | /** 43 | * @return string 44 | */ 45 | public function getBody() 46 | { 47 | return $this->body; 48 | } 49 | 50 | /** 51 | * @return array 52 | */ 53 | public function getDecodedBody() 54 | { 55 | try { 56 | $parsed = $this->decodeFromJson(); 57 | } catch (UnexpectedResponseFormatException $e) { 58 | $parsed = $this->decodeFromUrlParams(); 59 | } 60 | 61 | return $parsed; 62 | } 63 | 64 | /** 65 | * @return array 66 | * 67 | * @throws UnexpectedResponseFormatException 68 | */ 69 | public function decodeFromJson() 70 | { 71 | $parsed = json_decode($this->body, true); 72 | 73 | if (is_null($parsed)) { 74 | throw new UnexpectedResponseFormatException($this); 75 | } 76 | 77 | return $parsed; 78 | } 79 | 80 | /** 81 | * @return array 82 | * 83 | * @throws UnexpectedResponseFormatException 84 | */ 85 | public function decodeFromUrlParams() 86 | { 87 | if (strpos($this->body, '=') !== false) { 88 | parse_str($this->body, $parsed); 89 | } 90 | 91 | if (empty($parsed)) { 92 | throw new UnexpectedResponseFormatException($this); 93 | } 94 | 95 | return $parsed; 96 | } 97 | 98 | /** 99 | * @return array 100 | */ 101 | public function getInfo() 102 | { 103 | return $this->info; 104 | } 105 | 106 | /** 107 | * @return bool 108 | */ 109 | public function isZip() 110 | { 111 | return !empty($this->info['content_type']) && $this->info['content_type'] === 'application/zip'; 112 | } 113 | 114 | /** 115 | * @return bool 116 | */ 117 | public function isHtml() 118 | { 119 | return substr(trim($this->body), 0, 1) === '<'; 120 | } 121 | 122 | /** 123 | * @param string $path 124 | * 125 | * @return array 126 | */ 127 | public function saveToFile($path) 128 | { 129 | if (!file_exists($path)) { 130 | if (!@mkdir($path) && !is_dir($path)) { 131 | throw new \Exception('Cannot create directory ' . $path); 132 | }; 133 | } 134 | $file = tempnam($path, 'mautic_api_'); 135 | 136 | if (!is_writable($file)) { 137 | throw new \Exception($file.' is not writable'); 138 | } 139 | 140 | if (!$handle = fopen($file, 'w')) { 141 | throw new \Exception('Cannot open file '.$file); 142 | } 143 | 144 | if (fwrite($handle, $this->body) === false) { 145 | throw new \Exception('Cannot write into file '.$file); 146 | } 147 | 148 | fclose($handle); 149 | 150 | return array( 151 | 'file' => $file, 152 | ); 153 | } 154 | 155 | /** 156 | * @param string $response 157 | */ 158 | private function parseResponse($response) 159 | { 160 | $exploded = explode("\r\n\r\n", $response); 161 | $this->body = array_pop($exploded); 162 | $this->headers = implode("\r\n\r\n", $exploded); 163 | } 164 | 165 | /** 166 | * @throws UnexpectedResponseFormatException 167 | */ 168 | private function validate() 169 | { 170 | if (!in_array($this->info['http_code'], array(200, 201))) { 171 | $message = 'The response has unexpected status code ('.$this->info['http_code'].').'; 172 | throw new UnexpectedResponseFormatException($this, $message, $this->info['http_code']); 173 | } 174 | 175 | if ($this->isHtml()) { 176 | throw new UnexpectedResponseFormatException($this); 177 | } 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | tests 6 | 7 | 8 | 9 | 10 | 11 | lib 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/AbstractCustomFieldsTest.php: -------------------------------------------------------------------------------- 1 | assertFalse( 25 | empty($item['fields']['all']), 26 | '[fields][all] is missing:'.var_export($item, true) 27 | ); 28 | 29 | if (isset($item['fields']['all'][$itemProp])) { 30 | $item = $item['fields']['all']; 31 | } 32 | 33 | $this->assertTrue(isset($item[$itemProp]), $itemProp.' doesn\'t exist in the response: '.var_export($item, true)); 34 | $this->assertEquals($item[$itemProp], $itemVal); 35 | } 36 | } -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/AssetsTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('assets'); 18 | $this->testPayload = array( 19 | 'title' => 'Mautic Logo sent as a API request', 20 | 'storageLocation' => 'remote', 21 | 'file' => 'https://www.mautic.org/media/logos/logo/Mautic_Logo_DB.pdf' 22 | ); 23 | } 24 | 25 | public function testGetList() 26 | { 27 | $this->standardTestGetList(); 28 | } 29 | 30 | public function testGetListOfSpecificIds() 31 | { 32 | $this->standardTestGetListOfSpecificIds(); 33 | } 34 | 35 | public function testCreateWithLocalFileGetAndDelete() 36 | { 37 | // Upload a testing file 38 | $this->apiFiles = $this->getContext('files'); 39 | $this->apiFiles->setFolder('assets'); 40 | $fileRequest = array( 41 | 'file' => dirname(__DIR__).'/'.'mauticlogo.png' 42 | ); 43 | $response = $this->apiFiles->create($fileRequest); 44 | $this->assertErrors($response); 45 | $file = $response['file']; 46 | 47 | // Build local file payload 48 | $testPayload = $this->testPayload; 49 | $testPayload['storageLocation'] = 'local'; 50 | $testPayload['file'] = $file['name']; 51 | 52 | // Create Asset 53 | $response = $this->api->create($testPayload); 54 | $this->assertPayload($response, $testPayload); 55 | 56 | $response = $this->api->get($response[$this->api->itemName()]['id']); 57 | $this->assertPayload($response, $testPayload); 58 | 59 | // Delete Asset 60 | $response = $this->api->delete($response[$this->api->itemName()]['id']); 61 | $this->assertErrors($response); 62 | } 63 | 64 | public function testCreateWithRemoteFileGetAndDelete() 65 | { 66 | $this->standardTestCreateGetAndDelete(); 67 | } 68 | 69 | public function testBatchEndpoints() 70 | { 71 | $this->standardTestBatchEndpoints(); 72 | } 73 | 74 | public function testEditPatch() 75 | { 76 | $editTo = array( 77 | 'title' => 'test2', 78 | ); 79 | } 80 | 81 | public function testEditPut() 82 | { 83 | $this->standardTestEditPut(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/Auth/AbstractAuthTest.php: -------------------------------------------------------------------------------- 1 | config = include __DIR__.'/../../local.config.php'; 22 | } 23 | 24 | public function test404Response() 25 | { 26 | $auth = $this->getMockForAbstractClass(AbstractAuth::class); 27 | $this->expectException(UnexpectedResponseFormatException::class); 28 | $auth->makeRequest('https://github.com/mautic/api-library/this-page-does-not-exist'); 29 | } 30 | 31 | public function testHtmlResponse() 32 | { 33 | $auth = $this->getMockForAbstractClass(AbstractAuth::class); 34 | $this->expectException(UnexpectedResponseFormatException::class); 35 | $auth->makeRequest($this->config['baseUrl']); 36 | } 37 | 38 | public function testJsonResponse() 39 | { 40 | $auth = $this->getMockForAbstractClass(AbstractAuth::class); 41 | $response = $auth->makeRequest($this->config['apiUrl'].'contacts'); 42 | $this->assertTrue(is_array($response)); 43 | $this->assertFalse(empty($response)); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/Auth/BasicAuthTest.php: -------------------------------------------------------------------------------- 1 | configFile = __DIR__.'/../../local.config.php'; 23 | } 24 | 25 | /** 26 | * Verify that the error handling in setup method is working 27 | * - No Username 28 | * 29 | * @expectedException \Mautic\Exception\RequiredParameterMissingException 30 | * @expectedExceptionCode 500 31 | */ 32 | public function testParameterExceptionErrorNoUserName() 33 | { 34 | // This should throw an error becuse the userName is missing 35 | $apiAuth = new ApiAuth(); 36 | $auth = $apiAuth->newAuth(array('password'=>'********'), 'BasicAuth'); 37 | } 38 | 39 | /** 40 | * Verify that the error handling in setup method is working 41 | * - No Password 42 | * 43 | * @expectedException \Mautic\Exception\RequiredParameterMissingException 44 | * @expectedExceptionCode 500 45 | */ 46 | public function testParameterExceptionErrorNoPassword() 47 | { 48 | // This should throw an error becuse the password is missing 49 | $api = new ApiAuth(); 50 | $auth = $api->newAuth(array('userName'=>'anyolduser'), 'BasicAuth'); 51 | } 52 | 53 | /** 54 | * Verify that the error handling in setup method is working 55 | * - Empty Username 56 | * 57 | * @expectedException \Mautic\Exception\RequiredParameterMissingException 58 | * @expectedExceptionCode 500 59 | */ 60 | public function testParameterExceptionErrorEmptyUserName() 61 | { 62 | // This should throw an error becuse the userName is empty - test blanks 63 | $apiAuth = new ApiAuth(); 64 | $auth = $apiAuth->newAuth(array('userName'=>' ','password'=>'********'), 'BasicAuth' ); 65 | } 66 | 67 | /** 68 | * Verify that the error handling in setup method is working 69 | * - Empty password 70 | * 71 | * @expectedException \Mautic\Exception\RequiredParameterMissingException 72 | * @expectedExceptionCode 500 73 | */ 74 | public function testParameterExceptionErrorEmptyPassword() 75 | { 76 | // This should throw an error because the password is empty - test blanks 77 | $apiAuth = new ApiAuth(); 78 | $auth = $apiAuth->newAuth(array('userName'=>'admin','password'=>' '), 'BasicAuth' ); 79 | } 80 | 81 | /** 82 | * Ensure the Config has the correct settings 83 | */ 84 | public function testConfigReady() 85 | { 86 | $this->assertTrue(file_exists($this->configFile), 'Cannot find local.config.php!'); 87 | 88 | // get local config 89 | $config = include $this->configFile; 90 | 91 | // userName & password - ! empty 92 | $toCheck = array('userName','password'); 93 | foreach($toCheck as $toTest) { 94 | $this->assertTrue(isset($config[$toTest]), $toTest .' Check failed. Check '. $toTest .' in local.config.php.'); 95 | $this->assertTrue(!empty($config[$toTest]), $toTest .' must contain a value. Check '. $toTest .' in local.config.php.'); 96 | } 97 | } 98 | 99 | /** 100 | * @depends testConfigReady 101 | */ 102 | public function testPublicInterface() 103 | { 104 | $config = include $this->configFile; 105 | $apiAuth = new ApiAuth(); 106 | $auth = $apiAuth->newAuth($config, 'BasicAuth' ); 107 | 108 | $this->assertTrue($auth->isAuthorized(), 'Authorization failed. Check credentials in local.config.php.'); 109 | } 110 | 111 | /** 112 | * @depends testConfigReady 113 | */ 114 | public function testGetList() 115 | { 116 | $this->api = $this->getContext('contactFields'); 117 | $this->standardTestGetList(); 118 | } 119 | 120 | /** 121 | * Ignore this 122 | */ 123 | public function testSearchCommands() 124 | { 125 | // ignore 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/CategoriesTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('categories'); 16 | $this->testPayload = array( 17 | 'title' => 'test', 18 | 'bundle' => 'asset' 19 | ); 20 | } 21 | 22 | public function testGetList() 23 | { 24 | $this->standardTestGetList(); 25 | } 26 | 27 | public function testGetListOfSpecificIds() 28 | { 29 | $this->standardTestGetListOfSpecificIds(); 30 | } 31 | 32 | public function testCreateGetAndDelete() 33 | { 34 | $this->standardTestCreateGetAndDelete(); 35 | } 36 | 37 | public function testEditPatch() 38 | { 39 | $editTo = array( 40 | 'title' => 'test2', 41 | 'bundle' => 'asset' 42 | ); 43 | $this->standardTestEditPatch($editTo); 44 | } 45 | 46 | public function testEditPut() 47 | { 48 | $this->standardTestEditPut(); 49 | } 50 | 51 | public function testBatchEndpoints() 52 | { 53 | $this->standardTestBatchEndpoints(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/CompaniesTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('companies'); 16 | $this->testPayload = array( 17 | 'companyname' => 'test', 18 | 'companyemail' => 'test@company.com', 19 | 'companycity' => 'Raleigh', 20 | ); 21 | } 22 | 23 | public function testGetList() 24 | { 25 | $this->standardTestGetList(); 26 | } 27 | 28 | public function testCreateGetAndDelete() 29 | { 30 | $this->standardTestCreateGetAndDelete(); 31 | } 32 | 33 | public function testEditPatch() 34 | { 35 | $editTo = array( 36 | 'companyname' => 'test2', 37 | ); 38 | $this->standardTestEditPatch($editTo); 39 | } 40 | 41 | public function testEditPut() 42 | { 43 | $this->standardTestEditPut(); 44 | } 45 | 46 | public function testAddAndRemove() 47 | { 48 | // Create contact 49 | $contactsContext = $this->getContext('contacts'); 50 | $response = $contactsContext->create(array('firstname' => 'API segments test')); 51 | $this->assertErrors($response); 52 | $contact = $response['contact']; 53 | 54 | // Create company 55 | $response = $this->api->create($this->testPayload); 56 | $this->assertPayload($response); 57 | $company = $response[$this->api->itemName()]; 58 | 59 | // Add the contact to the company 60 | $response = $this->api->addContact($company['id'], $contact['id']); 61 | $this->assertErrors($response); 62 | $this->assertSuccess($response); 63 | 64 | // Test get contact companies API endpoint 65 | $contactContext = $this->getContext('contacts'); 66 | $response = $contactContext->getContactCompanies($contact['id']); 67 | $this->assertErrors($response); 68 | $this->assertEquals($response['total'], 1); 69 | $this->assertFalse(empty($response['companies'])); 70 | 71 | // Remove the contact from the company 72 | $response = $this->api->removeContact($company['id'], $contact['id']); 73 | $this->assertErrors($response); 74 | $this->assertSuccess($response); 75 | 76 | // Delete the contact and the segment 77 | $response = $contactsContext->delete($contact['id']); 78 | $this->assertErrors($response); 79 | $response = $this->api->delete($company['id']); 80 | $this->assertErrors($response); 81 | } 82 | 83 | public function testBatchEndpoints() 84 | { 85 | $this->standardTestBatchEndpoints(); 86 | } 87 | 88 | public function testBCEndpoints() 89 | { 90 | $this->api->bcTesting = array('addContact', 'removeContact'); 91 | $this->testAddAndRemove(); 92 | $this->api->bcTesting = false; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/CompanyFieldsTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('companyFields'); 21 | $this->testPayload = array( 22 | 'label' => $this->prefix.'API test field', 23 | 'type' => 'text', 24 | ); 25 | } 26 | 27 | protected function assertFieldPayloadList($response) 28 | { 29 | if (!empty($response[$this->api->listName()])) { 30 | foreach ($response[$this->api->listName()] as $item) { 31 | $this->assertSame('company', $item['object'], 'This field must be object of company '.print_r($item, true)); 32 | } 33 | } 34 | } 35 | 36 | // Methods inherited from ContactFieldsTest 37 | 38 | // Except following, ignore them 39 | public function testBooleanField() 40 | { 41 | return; 42 | } 43 | 44 | public function testDefaultFieldValue() 45 | { 46 | return; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/ContactFieldsTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('contactFields'); 19 | $this->testPayload = array( 20 | 'label' => $this->prefix.'API test field', 21 | 'type' => 'text', 22 | ); 23 | } 24 | 25 | protected function assertPayloadList($response) 26 | { 27 | parent::assertPayloadList($response); 28 | $this->assertFieldPayloadList($response); 29 | } 30 | 31 | protected function assertFieldPayloadList($response) 32 | { 33 | if (!empty($response[$this->api->listName()])) { 34 | foreach ($response[$this->api->listName()] as $item) { 35 | $this->assertSame('lead', $item['object'], 'This field must be object of lead '.print_r($item, true)); 36 | } 37 | } 38 | } 39 | 40 | public function testGetList() 41 | { 42 | $this->standardTestGetList(); 43 | } 44 | 45 | public function testCreateGetAndDelete() 46 | { 47 | $this->standardTestCreateGetAndDelete(); 48 | } 49 | 50 | public function testCreateGetAndDeleteOfLookupField() 51 | { 52 | $lookupField = array( 53 | 'label' => $this->prefix.'API test lookup field', 54 | 'type' => 'lookup', 55 | 'properties' => array( 56 | 'list' => array( 57 | array('label' => 'Mr', 'value' => 'mr'), 58 | array('label' => 'Mrs', 'value' => 'mrs'), 59 | array('label' => 'Miss', 'value' => 'miss'), 60 | ) 61 | ) 62 | ); 63 | 64 | $this->standardTestCreateGetAndDelete($lookupField); 65 | } 66 | 67 | public function testBooleanField() 68 | { 69 | // Create a testing contact 70 | $contactContext = $this->getContext('contacts'); 71 | $response = $contactContext->create(array('firstname' => 'Boolean Field', 'lastname' => 'API test')); 72 | $this->assertErrors($response); 73 | $contact = $response['contact']; 74 | 75 | 76 | $possibleValues = array(1 => 1, 0 => 0, 'yes' => 1, 'no' => 0, 'true' => 1, 'false' => 0); 77 | $boolField = array( 78 | 'label' => $this->prefix.'API test Boolean field', 79 | 'type' => 'boolean', 80 | 'properties' => array( 81 | 'no' => 'No', 82 | 'yes' => 'Yes' 83 | ) 84 | ); 85 | 86 | // Create the Boolean field 87 | $response = $this->api->create($boolField); 88 | $this->assertErrors($response); 89 | $field = $response[$this->api->itemName()]; 90 | 91 | // Test if the Boolean value gets updated with test values 92 | foreach ($possibleValues as $value => $boolValue) { 93 | $response = $contactContext->edit($contact['id'], array($field['alias'] => $value)); 94 | $this->assertErrors($response); 95 | $this->assertTrue(isset($response['contact']['fields']['all'][$field['alias']]), $field['alias'].' does not exist in the field list'); 96 | $this->assertEquals($response['contact']['fields']['all'][$field['alias']], $boolValue); 97 | } 98 | 99 | // Clean after youself 100 | $response = $this->api->delete($field['id']); 101 | $this->assertErrors($response); 102 | $response = $contactContext->delete($contact['id']); 103 | $this->assertErrors($response); 104 | } 105 | 106 | public function testDefaultFieldValue() 107 | { 108 | $defaultValue = 'little kitten'; 109 | 110 | $fieldPayload = $this->testPayload; 111 | $fieldPayload['defaultValue'] = $defaultValue; 112 | 113 | // Create the field 114 | $response = $this->api->create($fieldPayload); 115 | $this->assertPayload($response); 116 | $field = $response[$this->api->itemName()]; 117 | 118 | // Create a testing contact 119 | $contactContext = $this->getContext('contacts'); 120 | $response = $contactContext->create(array('firstname' => 'Default Value', 'lastname' => 'API test')); 121 | $this->assertErrors($response); 122 | $this->assertTrue(isset($response['contact']['fields']['all'][$field['alias']]), $field['alias'].' does not exist in the field list'); 123 | $this->assertEquals($response['contact']['fields']['all'][$field['alias']], $defaultValue); 124 | $contact = $response['contact']; 125 | 126 | // Clean after youself 127 | $response = $this->api->delete($field['id']); 128 | $this->assertErrors($response); 129 | $response = $contactContext->delete($contact['id']); 130 | $this->assertErrors($response); 131 | } 132 | 133 | public function testEditPatch() 134 | { 135 | $editTo = array( 136 | 'label' => 'test2', 137 | ); 138 | } 139 | 140 | public function testEditPut() 141 | { 142 | $this->standardTestEditPut(); 143 | } 144 | 145 | public function testBatchEndpoints() 146 | { 147 | $this->standardTestBatchEndpoints(); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/DevicesTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('devices'); 18 | $this->testPayload = array( 19 | 'device' => 'desktop', 20 | 'deviceOsName' => 'Ubuntu', 21 | 'deviceOsShortName' => 'UBT', 22 | 'deviceOsPlatform' => 'x64', 23 | ); 24 | 25 | // Create a contact for test 26 | $contactApi = $this->getContext('contacts'); 27 | $response = $contactApi->create(array('firstname' => 'Device API test')); 28 | $this->assertErrors($response); 29 | $this->testPayload['lead'] = $response['contact']['id']; 30 | } 31 | 32 | public function tearDown() { 33 | // Delete a contact from test 34 | $this->api = $this->getContext('contacts'); 35 | $response = $this->api->delete($this->testPayload['lead']); 36 | $this->assertErrors($response); 37 | } 38 | 39 | public function testGetList() 40 | { 41 | $this->standardTestGetList(); 42 | } 43 | 44 | public function testGetListOfSpecificIds() 45 | { 46 | $this->standardTestGetListOfSpecificIds(); 47 | } 48 | 49 | public function testCreateGetAndDelete() 50 | { 51 | $response = $this->api->create($this->testPayload); 52 | $this->assertPayload($response); 53 | 54 | // Test get contact devices endpoint 55 | $contactContext = $this->getContext('contacts'); 56 | $responseDevices = $contactContext->getContactDevices($this->testPayload['lead']); 57 | $this->assertErrors($responseDevices); 58 | $this->assertEquals($responseDevices['total'], 1); 59 | $this->assertFalse(empty($responseDevices['devices'][0]['id'])); 60 | $this->assertEquals($responseDevices['devices'][0]['id'], $response[$this->api->itemName()]['id']); 61 | 62 | $response = $this->api->get($response[$this->api->itemName()]['id']); 63 | $this->assertPayload($response); 64 | 65 | $response = $this->api->delete($response[$this->api->itemName()]['id']); 66 | $this->assertErrors($response); 67 | } 68 | 69 | public function testEditPatch() 70 | { 71 | $editTo = array( 72 | 'deviceOsName' => 'Edubuntu', 73 | ); 74 | $this->standardTestEditPatch($editTo); 75 | } 76 | 77 | public function testEditPut() 78 | { 79 | $this->standardTestEditPut(); 80 | } 81 | 82 | public function testBatchEndpoints() 83 | { 84 | $this->standardTestBatchEndpoints(); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/DynamicContentsTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('dynamicContents'); 16 | $this->testPayload = array( 17 | 'name' => 'test', 18 | 'content' => 'test' 19 | ); 20 | } 21 | 22 | public function testGetList() 23 | { 24 | $this->standardTestGetList(); 25 | } 26 | 27 | public function testGetListOfSpecificIds() 28 | { 29 | $this->standardTestGetListOfSpecificIds(); 30 | } 31 | 32 | public function testCreateGetAndDelete() 33 | { 34 | $this->standardTestCreateGetAndDelete(); 35 | } 36 | 37 | public function testEditPatch() 38 | { 39 | $editTo = array( 40 | 'name' => 'test2' 41 | ); 42 | $this->standardTestEditPatch($editTo); 43 | } 44 | 45 | public function testEditPut() 46 | { 47 | $this->standardTestEditPut(); 48 | } 49 | 50 | public function testBatchEndpoints() 51 | { 52 | $this->standardTestBatchEndpoints(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/ExceptionsTest.php: -------------------------------------------------------------------------------- 1 | assertEquals($expected, $exception->getMessage(), 'This should return "'.$expected.'"' ); 42 | $this->assertEquals(500, $exception->getCode()); 43 | } 44 | 45 | public function testContextNotFoundExceptionCustomMessage() { 46 | $exception = new ContextNotFoundException(self::CUSTOM_ERROR_MESSAGE); 47 | $this->assertEquals(self::CUSTOM_ERROR_MESSAGE, $exception->getMessage(), 'This should return "'.self::CUSTOM_ERROR_MESSAGE.'"' ); 48 | $this->assertEquals(500, $exception->getCode()); 49 | } 50 | 51 | public function testActionNotSupportedException() { 52 | $expected = 'Action is not supported at this time.'; 53 | $exception = new ActionNotSupportedException(); 54 | $this->assertEquals($expected, $exception->getMessage(), 'This should return "'.$expected.'"' ); 55 | $this->assertEquals(500, $exception->getCode()); 56 | } 57 | 58 | public function testActionNotSupportedExceptionCustomMessage() { 59 | $exception = new ActionNotSupportedException(self::CUSTOM_ERROR_MESSAGE); 60 | $this->assertEquals(self::CUSTOM_ERROR_MESSAGE, $exception->getMessage(), 'This should return "'.self::CUSTOM_ERROR_MESSAGE.'"' ); 61 | $this->assertEquals(500, $exception->getCode()); 62 | } 63 | 64 | public function testUnexpectedResponseFormatException() { 65 | $expected = 'The response returned is in an unexpected format.'."\n\nResponse: "; 66 | $exception = new UnexpectedResponseFormatException(new Response('', ['http_code' => 200])); 67 | $this->assertEquals($expected, $exception->getMessage(), 'This should return "'.$expected.'"' ); 68 | $this->assertEquals(500, $exception->getCode()); 69 | } 70 | 71 | public function testUnexpectedResponseFormatExceptionCustomMessage() { 72 | $expected = self::CUSTOM_ERROR_MESSAGE."\n\nResponse: "; 73 | $exception = new UnexpectedResponseFormatException(new Response('', ['http_code' => 200]), self::CUSTOM_ERROR_MESSAGE); 74 | $this->assertEquals($expected, $exception->getMessage(), 'This should return "'.$expected.'"' ); 75 | $this->assertEquals(500, $exception->getCode()); 76 | } 77 | 78 | public function testUnexpectedResponseFormatExceptionCustomCode() { 79 | $exception = new UnexpectedResponseFormatException(new Response('', ['http_code' => 200]), null, 404); 80 | $this->assertEquals(404, $exception->getCode()); 81 | } 82 | 83 | public function testIncorrectParametersReturnedException() { 84 | $expected = 'Incorrect parameters returned.'; 85 | $exception = new IncorrectParametersReturnedException(); 86 | $this->assertEquals($expected, $exception->getMessage(), 'This should return "'.$expected.'"' ); 87 | $this->assertEquals(500, $exception->getCode()); 88 | } 89 | 90 | public function testIncorrectParametersReturnedExceptionCustomMessage() { 91 | $exception = new IncorrectParametersReturnedException(self::CUSTOM_ERROR_MESSAGE); 92 | $this->assertEquals(self::CUSTOM_ERROR_MESSAGE, $exception->getMessage(), 'This should return "'.self::CUSTOM_ERROR_MESSAGE.'"' ); 93 | $this->assertEquals(500, $exception->getCode()); 94 | } 95 | 96 | public function testRequiredParameterMissingException() { 97 | $expected = 'Required Parameter is missing.'; 98 | $exception = new RequiredParameterMissingException(); 99 | $this->assertEquals($expected, $exception->getMessage(), 'This should return "'.$expected.'"' ); 100 | $this->assertEquals(500, $exception->getCode()); 101 | } 102 | 103 | public function testRequiredParameterMissingExceptionCustomMessage() { 104 | $exception = new RequiredParameterMissingException(self::CUSTOM_ERROR_MESSAGE); 105 | $this->assertEquals(self::CUSTOM_ERROR_MESSAGE, $exception->getMessage(), 'This should return "'.self::CUSTOM_ERROR_MESSAGE.'"' ); 106 | $this->assertEquals(500, $exception->getCode()); 107 | } 108 | 109 | public function testSearchCommands() { 110 | // overwrite this inheritted method with no content 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/FilesTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('files'); 17 | $this->testPayload['file'] = dirname(__DIR__).'/'.'mauticlogo.png'; 18 | $this->assertTrue(file_exists($this->testPayload['file']), 'A file for test at '.$this->testPayload['file'].' does not exist.'); 19 | } 20 | 21 | protected function assertPayload($response, array $payload = array(), $isBatch = false, $idColumn = 'id', $callback = null) 22 | { 23 | $this->assertErrors($response); 24 | $this->assertFalse(empty($response[$this->api->itemName()]['name']), 'The '.$this->api->itemName().' file name is empty.'); 25 | } 26 | 27 | public function testGetList() 28 | { 29 | $response = $this->api->getList(); 30 | $this->assertErrors($response); 31 | $this->assertTrue(isset($response[$this->api->listName()])); 32 | } 33 | 34 | public function testGetListSubdir() 35 | { 36 | $this->api->setFolder('images/flags'); 37 | $response = $this->api->getList(); 38 | $this->assertTrue(isset($response['files'])); 39 | $this->assertErrors($response); 40 | } 41 | 42 | public function testGetListAssetFiles() 43 | { 44 | $this->api->setFolder('assets'); 45 | $response = $this->api->getList(); 46 | $this->assertErrors($response); 47 | } 48 | 49 | public function testCreateAndDeleteImage() 50 | { 51 | $response = $this->api->create($this->testPayload); 52 | $this->assertPayload($response); 53 | $this->assertFalse(empty($response[$this->api->itemName()]['link']), 'The '.$this->api->itemName().' link is empty.'); 54 | 55 | $response = $this->api->delete($response['file']['name']); 56 | $this->assertErrors($response); 57 | $this->assertSuccess($response); 58 | } 59 | 60 | public function testCreateAndDeletePhpScript() 61 | { 62 | // Get this PHP script to send 63 | $this->testPayload['file'] = dirname(__DIR__).'/Api/FilesTest.php'; 64 | $this->assertTrue(file_exists($this->testPayload['file']), 'A file for test at '.$this->testPayload['file'].' does not exist.'); 65 | 66 | $response = $this->api->create($this->testPayload); 67 | $this->assertFalse(empty($response['error']), 'The PHP script was uploaded! Danger! DANGER!'); 68 | } 69 | 70 | public function testCreateAndDeleteImageInSubdir() 71 | { 72 | $this->api->setFolder('images/test_api_dir'); 73 | $response = $this->api->create($this->testPayload); 74 | $this->assertPayload($response); 75 | $this->assertFalse(empty($response[$this->api->itemName()]['link']), 'The '.$this->api->itemName().' link is empty.'); 76 | 77 | $response = $this->api->delete($response['file']['name']); 78 | $this->assertErrors($response); 79 | $this->assertSuccess($response); 80 | } 81 | 82 | public function testCreateAndDeleteAsset() 83 | { 84 | $this->api->setFolder('assets'); 85 | $response = $this->api->create($this->testPayload); 86 | $this->assertPayload($response); 87 | 88 | $response = $this->api->delete($response['file']['name']); 89 | $this->assertErrors($response); 90 | $this->assertSuccess($response); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/FocusTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('focus'); 19 | $this->testPayload = array( 20 | 'name' => 'test', 21 | 'type' => 'notice', 22 | 'website' => 'http://', 23 | 'style' => 'bar', 24 | 'htmlMode' => 1, 25 | 'html' => '
html mode enabled
', 26 | 'properties' => array( 27 | 'bar' => 28 | array( 29 | 'allow_hide' => 1, 30 | 'sticky' => 1, 31 | 'size' => 'large', 32 | 'placement' => 'top', 33 | ), 34 | 'modal' => 35 | array( 36 | 'placement' => 'top', 37 | ), 38 | 'notification' => 39 | array( 40 | 'placement' => 'top_left', 41 | ), 42 | 'animate' => 1, 43 | 'link_activation' => 1, 44 | 'colors' => array( 45 | 'primary' => '27184e', 46 | ), 47 | 'content' => array( 48 | 'headline' => '', 49 | 'font' => 'Arial, Helvetica, sans-serif', 50 | ), 51 | 'when' => 'immediately', 52 | 'frequency' => 'everypage', 53 | 'stop_after_conversion' => 1, 54 | ), 55 | ); 56 | } 57 | 58 | public function testGetList() 59 | { 60 | $this->standardTestGetList(); 61 | } 62 | 63 | public function testGetListOfSpecificIds() 64 | { 65 | $this->standardTestGetListOfSpecificIds(); 66 | } 67 | 68 | public function testCreateGetAndDelete() 69 | { 70 | $this->standardTestCreateGetAndDelete(); 71 | } 72 | 73 | public function testEditPatch() 74 | { 75 | $editTo = array( 76 | 'name' => 'test2', 77 | ); 78 | $this->standardTestEditPatch($editTo); 79 | } 80 | 81 | public function testEditPut() 82 | { 83 | $this->standardTestEditPut(); 84 | } 85 | 86 | public function testBatchEndpoints() 87 | { 88 | $this->standardTestBatchEndpoints(); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/LeadsTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('leads'); 18 | } 19 | 20 | // Use the method from ContactsTest to test the 'leads' endpoint for BC 21 | } 22 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/ListsTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('lists'); 16 | $this->testPayload = array( 17 | 'name' => 'API test' 18 | ); 19 | } 20 | 21 | // Use the methods from SegmentsTest, just make sure that BC for 'lists' context still work 22 | } 23 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/MessagesTest.php: -------------------------------------------------------------------------------- 1 | 'emails', 18 | 'sms' => 'smses', 19 | 'notification' => 'notifications', 20 | ); 21 | 22 | public function setUp() { 23 | $this->api = $this->getContext('messages'); 24 | $this->testPayload = array( 25 | 'name' => 'API message', 26 | 'description' => 'Marketing message created via API unit test', 27 | 'channels' => array( 28 | 'email' => array( 29 | 'channel' => 'email', 30 | 'channelId' => null, 31 | 'isEnabled' => true, 32 | ), 33 | 'sms' => array( 34 | 'channel' => 'sms', 35 | 'channelId' => null, 36 | 'isEnabled' => false, 37 | ), 38 | ), 39 | ); 40 | } 41 | 42 | protected function setUpPayloadClass() 43 | { 44 | foreach ($this->testPayload['channels'] as $key => $channel) { 45 | $contextName = $this->singularPlural[$channel['channel']]; 46 | $api = $this->getContext($contextName); 47 | $response = $api->create( 48 | array( 49 | 'name' => 'MM API test', // required for all 50 | 'message' => 'test', // required for sms 51 | 'heading' => 'test' // required for notifications 52 | ) 53 | ); 54 | $this->assertErrors($response); 55 | $this->testPayload['channels'][$key]['channelId'] = $response[$api->itemName()]['id']; 56 | } 57 | } 58 | 59 | protected function clearPayloadItems() 60 | { 61 | foreach ($this->testPayload['channels'] as $key => $channel) { 62 | $contextName = $this->singularPlural[$channel['channel']]; 63 | $api = $this->getContext($contextName); 64 | $response = $api->delete($this->testPayload['channels'][$key]['channelId']); 65 | $this->assertErrors($response); 66 | } 67 | } 68 | 69 | protected function assertPayload($response, array $payload = array(), $isBatch = false, $idColumn = 'id', $callback = null) 70 | { 71 | parent::assertPayload($response, $payload, $isBatch, $idColumn, $callback); 72 | 73 | // Assert channels 74 | if (!$isBatch) { 75 | $this->assertTrue(!empty($response[$this->api->itemName()])); 76 | foreach ($response[$this->api->itemName()]['channels'] as $responseChannel) { 77 | // All channels will be returned, even the empty ones 78 | if (isset($this->testPayload['channels'][$responseChannel['channel']])) { 79 | unset($responseChannel['id'], $responseChannel['channelName']); 80 | $this->assertSame($this->testPayload['channels'][$responseChannel['channel']], $responseChannel); 81 | } 82 | } 83 | } 84 | } 85 | 86 | public function testGetList() 87 | { 88 | $this->standardTestGetList(); 89 | } 90 | 91 | public function testGetListOfSpecificIds() 92 | { 93 | $this->setUpPayloadClass(); 94 | $this->standardTestGetListOfSpecificIds(); 95 | $this->clearPayloadItems(); 96 | } 97 | 98 | public function testCreateGetAndDelete() 99 | { 100 | $this->setUpPayloadClass(); 101 | $this->standardTestCreateGetAndDelete(); 102 | $this->clearPayloadItems(); 103 | } 104 | 105 | public function testEditPatch() 106 | { 107 | $this->setUpPayloadClass(); 108 | $this->standardTestEditPatch([ 109 | 'name' => 'Modified by PATCH', 110 | ]); 111 | $this->clearPayloadItems(); 112 | } 113 | 114 | public function testEditPut() 115 | { 116 | $this->setUpPayloadClass(); 117 | $this->standardTestEditPut(); 118 | $this->clearPayloadItems(); 119 | } 120 | 121 | public function testBatchEndpoints() 122 | { 123 | $this->standardTestBatchEndpoints(); 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/NotesTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('notes'); 18 | $this->testPayload = array( 19 | 'text' => 'Contact note created via API request', 20 | 'type' => 'general', 21 | ); 22 | 23 | // Create a contact for test 24 | $contactApi = $this->getContext('contacts'); 25 | $response = $contactApi->create(array('firstname' => 'Note API test')); 26 | $this->assertErrors($response); 27 | $this->testPayload['lead'] = $response['contact']['id']; 28 | } 29 | 30 | public function tearDown() { 31 | // Delete a contact from test 32 | $this->api = $this->getContext('contacts'); 33 | $response = $this->api->delete($this->testPayload['lead']); 34 | $this->assertErrors($response); 35 | } 36 | 37 | public function testGetList() 38 | { 39 | $this->standardTestGetList(); 40 | } 41 | 42 | public function testGetListOfSpecificIds() 43 | { 44 | $this->standardTestGetListOfSpecificIds(); 45 | } 46 | 47 | public function testCreateGetAndDelete() 48 | { 49 | $response = $this->api->create($this->testPayload); 50 | $this->assertPayload($response); 51 | 52 | // Test get contact notes endpoint 53 | $contactContext = $this->getContext('contacts'); 54 | $responseNotes = $contactContext->getContactNotes($this->testPayload['lead']); 55 | $this->assertErrors($responseNotes); 56 | $this->assertEquals($responseNotes['total'], 1); 57 | $this->assertFalse(empty($responseNotes['notes'])); 58 | 59 | $response = $this->api->get($response[$this->api->itemName()]['id']); 60 | $this->assertPayload($response); 61 | 62 | $response = $this->api->delete($response[$this->api->itemName()]['id']); 63 | $this->assertErrors($response); 64 | } 65 | 66 | public function testEditPatch() 67 | { 68 | $editTo = array( 69 | 'text' => 'test2', 70 | ); 71 | $this->standardTestEditPatch($editTo); 72 | } 73 | 74 | public function testEditPut() 75 | { 76 | $this->standardTestEditPut(); 77 | } 78 | 79 | public function testBatchEndpoints() 80 | { 81 | $this->standardTestBatchEndpoints(); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/NotificationsTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('notifications'); 16 | $this->testPayload = array( 17 | 'name' => 'test', 18 | 'heading' => 'API test heading', 19 | 'message' => 'API test message' 20 | ); 21 | } 22 | 23 | public function testGetList() 24 | { 25 | $this->standardTestGetList(); 26 | } 27 | 28 | public function testGetListOfSpecificIds() 29 | { 30 | $this->standardTestGetListOfSpecificIds(); 31 | } 32 | 33 | public function testCreateGetAndDelete() 34 | { 35 | $this->standardTestCreateGetAndDelete(); 36 | } 37 | 38 | public function testEditPatch() 39 | { 40 | $editTo = array( 41 | 'name' => 'test2' 42 | ); 43 | $this->standardTestEditPatch($editTo); 44 | } 45 | 46 | public function testEditPut() 47 | { 48 | $this->standardTestEditPut(); 49 | } 50 | 51 | public function testBatchEndpoints() 52 | { 53 | $this->standardTestBatchEndpoints(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/PagesTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('pages'); 16 | $this->testPayload = array( 17 | 'title' => 'test', 18 | 'template' => 'blank', 19 | 'customHtml' => ' 20 | 21 | 22 | 23 | 24 | 25 |
26 |
27 | 28 | 29 | 34 | 35 |
30 |
31 | Awesome Co 32 |
33 |
36 |
37 |
38 | 39 | ', 40 | ); 41 | } 42 | 43 | public function testGetList() 44 | { 45 | $this->standardTestGetList(); 46 | } 47 | 48 | public function testGetListOfSpecificIds() 49 | { 50 | $this->standardTestGetListOfSpecificIds(); 51 | } 52 | 53 | public function testCreateGetAndDelete() 54 | { 55 | $this->standardTestCreateGetAndDelete(); 56 | } 57 | 58 | public function testEditPatch() 59 | { 60 | $editTo = array( 61 | 'title' => 'test2', 62 | ); 63 | $this->standardTestEditPatch($editTo); 64 | } 65 | 66 | public function testEditPut() 67 | { 68 | $this->standardTestEditPut(); 69 | } 70 | 71 | public function testBatchEndpoints() 72 | { 73 | $this->standardTestBatchEndpoints(); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/PointTriggersTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('pointTriggers'); 16 | $this->testPayload = array( 17 | 'name' => 'test', 18 | 'description' => 'created as a API test', 19 | 'points' => 5, 20 | 'color' => '4e5d9d', 21 | 'triggerExistingLeads' => false, 22 | 'events' => array( 23 | array( 24 | 'name' => 'tag test event', 25 | 'description' => 'created as a API test', 26 | 'type' => 'lead.changetags', 27 | 'order' => 1, 28 | 'properties' => array( 29 | 'add_tags' => array('tag-a'), 30 | 'remove_tags' => array() 31 | ) 32 | ), 33 | array( 34 | 'name' => 'send email test event', 35 | 'description' => 'created as a API test', 36 | 'type' => 'email.send', 37 | 'order' => 2, 38 | 'properties' => array( 39 | 'email' => 1 40 | ) 41 | ) 42 | ) 43 | ); 44 | } 45 | 46 | protected function assertPayload($response, array $payload = array(), $isBatch = false, $idColumn = 'id', $callback = null) 47 | { 48 | parent::assertPayload($response, $payload, $isBatch, $idColumn, array($this, 'validateComponentsPayload')); 49 | } 50 | 51 | protected function validateComponentsPayload($itemProp, $itemVal, $item) 52 | { 53 | $this->assertFalse(empty($item['events']), 'The point trigger event array is empty: '.var_export($item, true)); 54 | 55 | switch ($itemProp) { 56 | case 'events': 57 | end($itemVal); 58 | $key = key($itemVal); 59 | $this->assertSame($itemVal[$key]['name'], $item['events'][$key]['name'], 'Event names do not match: '.var_export($item, true)); 60 | break; 61 | default: 62 | $this->assertSame($item[$itemProp], $itemVal); 63 | } 64 | } 65 | 66 | 67 | public function testGetList() 68 | { 69 | $this->standardTestGetList(); 70 | } 71 | 72 | public function testGetListOfSpecificIds() 73 | { 74 | $this->standardTestGetListOfSpecificIds(); 75 | } 76 | 77 | public function testCreateGetAndDelete() 78 | { 79 | $this->standardTestCreateGetAndDelete(); 80 | } 81 | 82 | public function testEditPatch() 83 | { 84 | $editTo = array( 85 | 'name' => 'test2', 86 | 'events' => $this->testPayload['events'] 87 | ); 88 | $this->standardTestEditPatch($editTo); 89 | } 90 | 91 | public function testEditPut() 92 | { 93 | $this->standardTestEditPut(); 94 | } 95 | 96 | public function testEventDeleteViaPut() 97 | { 98 | $response = $this->api->edit(10000, $this->testPayload, true); 99 | $this->assertErrors($response); 100 | 101 | // Remove the trigger events 102 | unset($response[$this->api->itemName()]['events']); 103 | 104 | // Edit the same entitiy without the fields and actions 105 | $response = $this->api->edit( 106 | $response[$this->api->itemName()]['id'], 107 | $response[$this->api->itemName()], 108 | true 109 | ); 110 | 111 | $this->assertErrors($response); 112 | $this->assertTrue(empty($response[$this->api->itemName()]['events']), 'Trigger events were not deleted via PUT request'); 113 | 114 | //now delete the form 115 | $response = $this->api->delete($response[$this->api->itemName()]['id']); 116 | $this->assertErrors($response); 117 | } 118 | 119 | public function testDeleteEvents() 120 | { 121 | $eventIds = array(); 122 | $response = $this->api->create($this->testPayload); 123 | $this->assertErrors($response); 124 | 125 | foreach ($response[$this->api->itemName()]['events'] as $event) { 126 | $eventIds[] = $event['id']; 127 | } 128 | 129 | $response = $this->api->deleteTriggerEvents($response[$this->api->itemName()]['id'], $eventIds); 130 | $this->assertErrors($response); 131 | $this->assertTrue(empty($response[$this->api->itemName()]['events']), 'Events were not deleted'); 132 | 133 | //now delete the trigger 134 | $response = $this->api->delete($response[$this->api->itemName()]['id']); 135 | $this->assertErrors($response); 136 | } 137 | 138 | public function testGetEventTypes() 139 | { 140 | $response = $this->api->getEventTypes(); 141 | $this->assertErrors($response); 142 | $this->assertFalse(empty($response['eventTypes']), 'The eventTypes array is empty.'); 143 | } 144 | 145 | public function testBatchEndpoints() 146 | { 147 | $this->standardTestBatchEndpoints(null, function ($response, &$batch, $action) { 148 | switch ($action) { 149 | case 'create': 150 | foreach ($batch as &$item) { 151 | unset($item['events']); 152 | } 153 | break; 154 | } 155 | }); 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/PointsTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('points'); 16 | $this->testPayload = array( 17 | 'name' => 'test', 18 | 'delta' => 5, 19 | 'type' => 'page.hit', 20 | 'description' => 'created as a API test' 21 | ); 22 | } 23 | 24 | public function testGetList() 25 | { 26 | $this->standardTestGetList(); 27 | } 28 | 29 | public function testGetListOfSpecificIds() 30 | { 31 | $this->standardTestGetListOfSpecificIds(); 32 | } 33 | 34 | public function testCreateGetAndDelete() 35 | { 36 | $this->standardTestCreateGetAndDelete(); 37 | } 38 | 39 | public function testEditPatch() 40 | { 41 | $editTo = array( 42 | 'name' => 'test2', 43 | ); 44 | $this->standardTestEditPatch($editTo); 45 | } 46 | 47 | public function testEditPut() 48 | { 49 | $this->standardTestEditPut(); 50 | } 51 | 52 | public function testGetPointActionTypes() 53 | { 54 | $response = $this->api->getPointActionTypes(); 55 | $this->assertErrors($response); 56 | $this->assertFalse(empty($response['pointActionTypes']), 'The pointActionTypes array is empty.'); 57 | } 58 | 59 | public function testBatchEndpoints() 60 | { 61 | $this->standardTestBatchEndpoints(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/ReportsTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('reports'); 16 | } 17 | 18 | public function testGet() 19 | { 20 | $response = $this->api->get(1); 21 | $this->assertErrors($response); 22 | } 23 | 24 | public function testGetList() 25 | { 26 | $this->standardTestGetList(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/ResponseInfoTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('contacts'); 16 | $response = $this->api->getList('', 0, 1); 17 | $this->assertErrors($response); 18 | } 19 | 20 | public function testGetVersion() { 21 | $version = $this->api->getMauticVersion(); 22 | $this->assertRegExp("/^(\d+\.)?(\d+\.)?(.+|\d+)$/", $version); 23 | } 24 | 25 | public function testResponseInfo() { 26 | $info = $this->api->getResponseInfo(); 27 | $this->assertEquals($info['content_type'], 'application/json'); 28 | } 29 | 30 | public function testResponseHeaders() { 31 | $headers = $this->api->getResponseHeaders(); 32 | $this->assertEquals($headers[0], 'HTTP/1.1 200 OK'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/RolesTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('roles'); 16 | $this->testPayload = array( 17 | 'name' => 'API test role', 18 | 'description' => 'created via AIP', 19 | 'rawPermissions' => array ( 20 | 'email:emails' => 21 | array ( 22 | 'viewown', 23 | 'viewother', 24 | ), 25 | ) 26 | ); 27 | } 28 | 29 | public function testGetList() 30 | { 31 | $this->standardTestGetList(); 32 | } 33 | 34 | public function testGetListOfSpecificIds() 35 | { 36 | $this->standardTestGetListOfSpecificIds(); 37 | } 38 | 39 | public function testCreateGetAndDelete() 40 | { 41 | $this->standardTestCreateGetAndDelete(); 42 | } 43 | 44 | public function testEditPatch() 45 | { 46 | $editTo = array( 47 | 'name' => 'test2', 48 | ); 49 | $this->standardTestEditPatch($editTo); 50 | } 51 | 52 | public function testEditPut() 53 | { 54 | $this->standardTestEditPut(); 55 | } 56 | 57 | public function testBatchEndpoints() 58 | { 59 | $this->standardTestBatchEndpoints(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/SmsesTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('smses'); 16 | $this->testPayload = array( 17 | 'name' => 'test', 18 | 'message' => 'API test message' 19 | ); 20 | } 21 | 22 | public function testGetList() 23 | { 24 | $this->standardTestGetList(); 25 | } 26 | 27 | public function testGetListOfSpecificIds() 28 | { 29 | $this->standardTestGetListOfSpecificIds(); 30 | } 31 | 32 | public function testCreateGetAndDelete() 33 | { 34 | $this->standardTestCreateGetAndDelete(); 35 | } 36 | 37 | public function testEditPatch() 38 | { 39 | $editTo = array( 40 | 'name' => 'test2', 41 | ); 42 | $this->standardTestEditPatch($editTo); 43 | } 44 | 45 | public function testEditPut() 46 | { 47 | $this->standardTestEditPut(); 48 | } 49 | 50 | public function testBatchEndpoints() 51 | { 52 | $this->standardTestBatchEndpoints(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/StagesTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('stages'); 16 | $this->testPayload = array( 17 | 'name' => 'test', 18 | ); 19 | } 20 | 21 | public function testGetList() 22 | { 23 | $this->standardTestGetList(); 24 | } 25 | 26 | public function testGetListOfSpecificIds() 27 | { 28 | $this->standardTestGetListOfSpecificIds(); 29 | } 30 | 31 | public function testCreateGetAndDelete() 32 | { 33 | $this->standardTestCreateGetAndDelete(); 34 | } 35 | 36 | public function testEditPatch() 37 | { 38 | $editTo = array( 39 | 'name' => 'test2', 40 | ); 41 | $this->standardTestEditPatch($editTo); 42 | } 43 | 44 | public function testEditPut() 45 | { 46 | $this->standardTestEditPut(); 47 | } 48 | 49 | public function testAddAndRemove() 50 | { 51 | // Create contact 52 | $contactsContext = $this->getContext('contacts'); 53 | $response = $contactsContext->create(array('firstname' => 'API stages test')); 54 | $this->assertErrors($response); 55 | $contact = $response['contact']; 56 | 57 | // Create stage 58 | $response = $this->api->create($this->testPayload); 59 | $this->assertPayload($response); 60 | $stage = $response[$this->api->itemName()]; 61 | 62 | // Add contact to the stage 63 | $response = $this->api->addContact($stage['id'], $contact['id']); 64 | $this->assertErrors($response); 65 | $this->assertSuccess($response); 66 | 67 | // Remove the contact from the stage 68 | $response = $this->api->removeContact($stage['id'], $contact['id']); 69 | $this->assertErrors($response); 70 | $this->assertSuccess($response); 71 | 72 | // Delete the contact and the stage 73 | $response = $contactsContext->delete($contact['id']); 74 | $this->assertErrors($response); 75 | $response = $this->api->delete($stage['id']); 76 | $this->assertErrors($response); 77 | } 78 | 79 | public function testBatchEndpoints() 80 | { 81 | $this->standardTestBatchEndpoints(); 82 | } 83 | 84 | public function testBCEndpoints() 85 | { 86 | $this->api->bcTesting = array('addContact', 'removeContact'); 87 | $this->testAddAndRemove(); 88 | $this->api->bcTesting = false; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/TagsTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('tags'); 17 | $this->testPayload = array( 18 | 'tag' => 'API-tag', 19 | ); 20 | } 21 | 22 | public function testGetList() 23 | { 24 | $this->standardTestGetList(); 25 | } 26 | 27 | public function testGetListOfSpecificIds() 28 | { 29 | // Create some tags first 30 | $itemIds = array(); 31 | for ($i = 0; $i <= 2; $i++) { 32 | $response = $this->api->create(array('tag' => 'api-test-tag'.$i)); 33 | $this->assertErrors($response); 34 | $itemIds[] = $response[$this->api->itemName()]['id']; 35 | } 36 | 37 | $search = 'ids:'.implode(',', $itemIds); 38 | $response = $this->api->getList($search); 39 | $this->assertErrors($response); 40 | $this->assertEquals(count($itemIds), $response['total']); 41 | 42 | foreach ($response[$this->api->listName()] as $item) { 43 | $this->assertTrue(in_array($item['id'], $itemIds)); 44 | $this->api->delete($item['id']); 45 | $this->assertErrors($response); 46 | } 47 | } 48 | 49 | public function testCreateGetAndDelete() 50 | { 51 | $this->standardTestCreateGetAndDelete(); 52 | } 53 | 54 | public function testEditPatch() 55 | { 56 | $editTo = array( 57 | 'tag' => 'API-tag-edit', 58 | ); 59 | $this->standardTestEditPatch($editTo); 60 | } 61 | 62 | public function testEditPut() 63 | { 64 | $this->standardTestEditPut(); 65 | } 66 | 67 | public function testBatchEndpoints() 68 | { 69 | $this->standardTestBatchEndpoints( 70 | array( 71 | array('tag' => 'api-test-tag1'), 72 | array('tag' => 'api-test-tag2'), 73 | array('tag' => 'api-test-tag3'), 74 | ) 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/ThemesTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('themes'); 17 | } 18 | 19 | public function testGetList() 20 | { 21 | $response = $this->api->getList(); 22 | $this->assertErrors($response); 23 | $this->assertTrue(isset($response[$this->api->listName()])); 24 | $this->assertTrue(isset($response[$this->api->listName()]['blank'])); 25 | $this->assertTrue(isset($response[$this->api->listName()]['blank']['config'])); 26 | $this->assertSame($response[$this->api->listName()]['blank']['name'], 'Blank'); 27 | $this->assertSame($response[$this->api->listName()]['blank']['key'], 'blank'); 28 | } 29 | 30 | public function testGetCreateAndDelete() 31 | { 32 | $themeName = 'api_test'; 33 | 34 | // Get blank theme 35 | $response = $this->api->get('blank'); 36 | $this->assertErrors($response); 37 | $this->assertFalse(empty($response['file'])); 38 | $this->assertTrue(file_exists($response['file'])); 39 | 40 | // Test setTemporaryFilePath 41 | $dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mytempdir'; 42 | $this->api->setTemporaryFilePath($dir); 43 | $response = $this->api->get('blank'); 44 | $this->assertErrors($response); 45 | $this->assertFalse(empty($response['file'])); 46 | $this->assertTrue(file_exists($response['file'])); 47 | $this->assertEquals(realpath($dir), dirname($response['file'])); 48 | 49 | // Create a new theme from the theme we just got 50 | $tmpFile = dirname(__DIR__).'/'.$themeName.'.zip'; 51 | $this->assertTrue(rename($response['file'], $tmpFile), 'could not create '.$tmpFile); 52 | $response = $this->api->create(array('file' => $tmpFile)); 53 | $this->assertErrors($response); 54 | $this->assertTrue($response['success']); 55 | 56 | // Delete the local copy of the theme 57 | unlink($tmpFile); 58 | 59 | // Ensure the theme we created is listed 60 | $response = $this->api->getList(); 61 | $this->assertErrors($response); 62 | $this->assertTrue(isset($response[$this->api->listName()][$themeName])); 63 | 64 | // Delete the theme we just created 65 | $response = $this->api->delete($themeName); 66 | $this->assertErrors($response); 67 | $this->assertSuccess($response); 68 | 69 | // Ensure the theme we created is not listed 70 | $response = $this->api->getList(); 71 | $this->assertErrors($response); 72 | $this->assertFalse(isset($response[$this->api->listName()][$themeName])); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/TweetsTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('tweets'); 16 | $this->testPayload = array( 17 | 'name' => 'API test', 18 | 'text' => 'API test tweet', 19 | 'description' => 'Created via API tests', 20 | ); 21 | } 22 | 23 | public function testGetList() 24 | { 25 | $this->standardTestGetList(); 26 | } 27 | 28 | public function testGetListOfSpecificIds() 29 | { 30 | $this->standardTestGetListOfSpecificIds(); 31 | } 32 | 33 | public function testCreateGetAndDelete() 34 | { 35 | $this->standardTestCreateGetAndDelete(); 36 | } 37 | 38 | public function testEditPatch() 39 | { 40 | $editTo = array( 41 | 'name' => 'API test name updated' 42 | ); 43 | $this->standardTestEditPatch($editTo); 44 | } 45 | 46 | public function testEditPut() 47 | { 48 | $this->standardTestEditPut(); 49 | } 50 | 51 | public function testBatchEndpoints() 52 | { 53 | $this->standardTestBatchEndpoints(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/UsersTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('users'); 18 | $this->testPayload = $this->getUniqueUser(); 19 | } 20 | 21 | protected function generateRandomUsername($length = 8) { 22 | $x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 23 | return 'API_'.substr(str_shuffle(str_repeat($x, ceil($length / strlen($x)))), 1, $length); 24 | } 25 | 26 | protected function getUniqueUser() { 27 | $username = $this->generateRandomUsername(); 28 | return array( 29 | 'username' => $username, 30 | 'firstName' => 'API', 31 | 'lastName' => 'Test', 32 | 'email' => $username.'@email.com', 33 | 'plainPassword' => array( 34 | 'password' => 'topSecret007', 35 | 'confirm' => 'topSecret007', 36 | ), 37 | 'role' => 1, // Should exist in every Mautic instance 38 | ); 39 | } 40 | 41 | public function testGetList() 42 | { 43 | $this->standardTestGetList(); 44 | } 45 | 46 | public function testGetListOfSpecificIds() 47 | { 48 | // Create some items first 49 | $itemIds = array(); 50 | $response = $this->api->create($this->testPayload); 51 | $this->assertErrors($response); 52 | $itemIds[] = $response[$this->api->itemName()]['id']; 53 | $user2 = $this->getUniqueUser(); 54 | $response = $this->api->create($user2); 55 | $this->assertErrors($response); 56 | $itemIds[] = $response[$this->api->itemName()]['id']; 57 | 58 | $search = 'ids:'.implode(',', $itemIds); 59 | $response = $this->api->getList($search); 60 | $this->assertErrors($response); 61 | $this->assertEquals(count($itemIds), $response['total']); 62 | 63 | foreach ($response[$this->api->listName()] as $item) { 64 | $this->assertTrue(in_array($item['id'], $itemIds)); 65 | $this->api->delete($item['id']); 66 | $this->assertErrors($response); 67 | } 68 | } 69 | 70 | public function testCreateGetAndDelete() 71 | { 72 | $this->standardTestCreateGetAndDelete(); 73 | } 74 | 75 | public function testEditPatch() 76 | { 77 | $editTo = array( 78 | 'lastName' => 'test2', 79 | ); 80 | $this->standardTestEditPatch($editTo); 81 | } 82 | 83 | public function testEditPut() 84 | { 85 | $this->standardTestEditPut(); 86 | } 87 | 88 | public function testGetSelf() 89 | { 90 | $response = $this->api->getSelf(); 91 | $this->assertErrors($response); 92 | } 93 | 94 | public function testGetSelfPermissionsString() 95 | { 96 | $response = $this->api->getSelf(); 97 | $this->assertErrors($response); 98 | 99 | $permission = 'user:users:create'; 100 | $response = $this->api->checkPermission($response['id'], $permission); 101 | $this->assertErrors($response); 102 | $this->assertTrue(isset($response[$permission])); 103 | } 104 | 105 | public function testGetSelfPermissionsArray() 106 | { 107 | $response = $this->api->getSelf(); 108 | $this->assertErrors($response); 109 | 110 | $permission = array('user:users:create', 'user:users:edit'); 111 | $response = $this->api->checkPermission($response['id'], $permission); 112 | $this->assertErrors($response); 113 | foreach ($permission as $p) { 114 | $this->assertTrue(isset($response[$p])); 115 | } 116 | } 117 | 118 | public function testBatchEndpoints() 119 | { 120 | $batch = array( 121 | $this->getUniqueUser(), 122 | $this->getUniqueUser(), 123 | $this->getUniqueUser(), 124 | ); 125 | 126 | $this->standardTestBatchEndpoints($batch); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/Api/WebhooksTest.php: -------------------------------------------------------------------------------- 1 | api = $this->getContext('webhooks'); 18 | $this->testPayload = array( 19 | 'name' => 'test', 20 | 'description' => 'Created via API', 21 | 'webhookUrl' => 'http://some.url', 22 | 'eventsOrderbyDir' => 'DESC', 23 | 'triggers' => array( 24 | 'mautic.lead_post_save_update', 25 | 'mautic.lead_post_save_new', 26 | ) 27 | ); 28 | } 29 | 30 | public function testGetList() 31 | { 32 | $this->standardTestGetList(); 33 | } 34 | 35 | public function testGetListOfSpecificIds() 36 | { 37 | $this->standardTestGetListOfSpecificIds(); 38 | } 39 | 40 | public function testCreateGetAndDelete() 41 | { 42 | $this->standardTestCreateGetAndDelete(); 43 | } 44 | 45 | public function testCreateWithWrongOrderDir() 46 | { 47 | $this->testPayload['eventsOrderbyDir'] = 'abrakadabra'; 48 | $response = $this->api->create($this->testPayload); 49 | 50 | $this->assertFalse(empty($response['errors'])); 51 | } 52 | 53 | public function testCreateWithUndefinedOrderDir() 54 | { 55 | unset($this->testPayload['eventsOrderbyDir']); 56 | 57 | $this->standardTestCreateGetAndDelete($this->testPayload); 58 | } 59 | 60 | public function testEditPatch() 61 | { 62 | $editTo = array( 63 | 'name' => 'test2', 64 | 'description' => 'Updated via API', 65 | ); 66 | $this->standardTestEditPatch($editTo); 67 | } 68 | 69 | public function testEditPut() 70 | { 71 | $this->standardTestEditPut(); 72 | } 73 | 74 | public function testBatchEndpoints() 75 | { 76 | $this->standardTestBatchEndpoints(); 77 | } 78 | 79 | public function testAddingTriggerToWebhook() 80 | { 81 | $response = $this->api->create($this->testPayload); 82 | $this->assertPayload($response); 83 | 84 | $editTo = $response[$this->api->itemName()]; 85 | 86 | $editTo['triggers'][] = 'mautic.email_on_open'; 87 | 88 | $response = $this->api->edit($response[$this->api->itemName()]['id'], $editTo); 89 | $this->assertPayload($response, $editTo); 90 | 91 | $response = $this->api->delete($response[$this->api->itemName()]['id']); 92 | $this->assertErrors($response); 93 | } 94 | 95 | public function testRemovingTriggerFromWebhook() 96 | { 97 | $response = $this->api->create($this->testPayload); 98 | $this->assertPayload($response); 99 | 100 | $editTo = $response[$this->api->itemName()]; 101 | 102 | $editTo['triggers'] = ['mautic.email_on_open']; 103 | 104 | $response = $this->api->edit($response[$this->api->itemName()]['id'], $editTo, true); 105 | $this->assertPayload($response, $editTo); 106 | 107 | $response = $this->api->delete($response[$this->api->itemName()]['id']); 108 | $this->assertErrors($response); 109 | } 110 | 111 | public function testGetWebhookTriggers() 112 | { 113 | $response = $this->api->getTriggers(); 114 | 115 | $this->assertTrue(isset($response['triggers'])); 116 | 117 | $this->assertTrue(isset($response['triggers']['mautic.lead_post_save_new'])); 118 | $this->assertTrue(isset($response['triggers']['mautic.lead_post_save_update'])); 119 | $this->assertTrue(isset($response['triggers']['mautic.lead_post_delete'])); 120 | $this->assertTrue(isset($response['triggers']['mautic.lead_points_change'])); 121 | $this->assertTrue(isset($response['triggers']['mautic.email_on_open'])); 122 | $this->assertTrue(isset($response['triggers']['mautic.form_on_submit'])); 123 | $this->assertTrue(isset($response['triggers']['mautic.page_on_hit'])); 124 | 125 | $this->assertTrue(isset($response['triggers']['mautic.page_on_hit']['label'])); 126 | $this->assertTrue(isset($response['triggers']['mautic.page_on_hit']['description'])); 127 | 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/QueryBuilder/WhereBuilderTest.php: -------------------------------------------------------------------------------- 1 | $method($method, $val[0], $val[1]); 52 | $ignoreWhere = true; 53 | break; 54 | case 'isNull': 55 | case 'isNotNull': 56 | case 'isEmpty': 57 | case 'isNotEmpty': 58 | $val = null; 59 | break; 60 | default: 61 | $val = 1; 62 | } 63 | $clauses[] = array( 64 | 'col' => $method, 65 | 'expr' => $method, 66 | 'val' => $val 67 | ); 68 | 69 | if (empty($ignoreWhere)) { 70 | $whereBuilder->$method($method, $val); 71 | } 72 | } 73 | 74 | $this->assertEquals($clauses, $whereBuilder->getClauses()); 75 | 76 | $andX = $whereBuilder->andX(); 77 | $andX->eq('eq', 2) 78 | ->neq('neq', 2) 79 | ->between('between', 1, 2); 80 | 81 | $clauses[] = array( 82 | 'col' => null, 83 | 'expr' => 'andX', 84 | 'val' => array( 85 | array( 86 | 'col' => 'eq', 87 | 'expr' => 'eq', 88 | 'val' => 2 89 | ), 90 | array( 91 | 'col' => 'neq', 92 | 'expr' => 'neq', 93 | 'val' => 2 94 | ), 95 | array( 96 | 'col' => 'between', 97 | 'expr' => 'between', 98 | 'val' => array(1,2) 99 | ), 100 | ), 101 | ); 102 | 103 | $whereBuilder->add($andX); 104 | 105 | $this->assertEquals($clauses, $whereBuilder->getClauses()); 106 | } 107 | } -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | = 2.4 13 | | 14 | | Pass this as the second parameter to specify which to use. 15 | | 16 | | If commented out, will default OAuth. see MauticApiTestCase::getAuth() 17 | | 18 | */ 19 | // 'AuthMethod' => 'BasicAuth', 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Basic Authentication credentials 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Basic Auth uses a simple username password method. 27 | | 28 | | It's important to note, that this is not recommended unless you are 29 | | using HTTPS as your username and password are exposed. 30 | | 31 | | BOTH the username and password are required. It's recommended that 32 | | you add a specific user and ensure a long passPhrase! 33 | | 34 | */ 35 | // 'userName' => '', 36 | // 'password' => '', 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | OAuth credentials 41 | |-------------------------------------------------------------------------- 42 | | 43 | | The API supports both OAuth1a and OAuth2. 44 | | 45 | | I've found there is more control if you specify which version you want 46 | | to use. 47 | | 48 | | Required mainly for OAuth 1a testing; 'OAuth1a' or 'OAuth2' 49 | | 50 | */ 51 | 'version' => 'OAuth1a', 52 | 53 | // Required for OAuth1a and OAuth2 54 | 'baseUrl' => 'http://example.com/index_dev.php', 55 | 56 | // Required for All tests 57 | 'apiUrl' => 'http://example.com/index_dev.php/api/', 58 | // Required for EmailsTest 59 | 'testEmail' => 'notexisting@email.com', 60 | 61 | // Required for both OAuth 1a and 2 testing 62 | 'accessToken' => '', 63 | 64 | // Required only for OAuth 1a testing 65 | 'accessTokenSecret' => '', 66 | 'requestTokenUrl' => '', // Set with any string to force the library to use the OAuth1.a spec; leave blank to use OAuth2 67 | 'clientKey' => '', 68 | 'clientSecret' => '', 69 | 'callback' => '', 70 | 71 | // Required only for OAuth 2 testing. 72 | 'refreshToken' => '' 73 | 74 | ); 75 | -------------------------------------------------------------------------------- /vendor/mautic/api-library/tests/mauticlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxitromer/wootic/a253a50e1935f28658882bfd16ff3deb44439a6a/vendor/mautic/api-library/tests/mauticlogo.png -------------------------------------------------------------------------------- /vendor/psr/log/.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | -------------------------------------------------------------------------------- /vendor/psr/log/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 PHP Framework Interoperability Group 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/psr/log/Psr/Log/AbstractLogger.php: -------------------------------------------------------------------------------- 1 | log(LogLevel::EMERGENCY, $message, $context); 25 | } 26 | 27 | /** 28 | * Action must be taken immediately. 29 | * 30 | * Example: Entire website down, database unavailable, etc. This should 31 | * trigger the SMS alerts and wake you up. 32 | * 33 | * @param string $message 34 | * @param array $context 35 | * 36 | * @return void 37 | */ 38 | public function alert($message, array $context = array()) 39 | { 40 | $this->log(LogLevel::ALERT, $message, $context); 41 | } 42 | 43 | /** 44 | * Critical conditions. 45 | * 46 | * Example: Application component unavailable, unexpected exception. 47 | * 48 | * @param string $message 49 | * @param array $context 50 | * 51 | * @return void 52 | */ 53 | public function critical($message, array $context = array()) 54 | { 55 | $this->log(LogLevel::CRITICAL, $message, $context); 56 | } 57 | 58 | /** 59 | * Runtime errors that do not require immediate action but should typically 60 | * be logged and monitored. 61 | * 62 | * @param string $message 63 | * @param array $context 64 | * 65 | * @return void 66 | */ 67 | public function error($message, array $context = array()) 68 | { 69 | $this->log(LogLevel::ERROR, $message, $context); 70 | } 71 | 72 | /** 73 | * Exceptional occurrences that are not errors. 74 | * 75 | * Example: Use of deprecated APIs, poor use of an API, undesirable things 76 | * that are not necessarily wrong. 77 | * 78 | * @param string $message 79 | * @param array $context 80 | * 81 | * @return void 82 | */ 83 | public function warning($message, array $context = array()) 84 | { 85 | $this->log(LogLevel::WARNING, $message, $context); 86 | } 87 | 88 | /** 89 | * Normal but significant events. 90 | * 91 | * @param string $message 92 | * @param array $context 93 | * 94 | * @return void 95 | */ 96 | public function notice($message, array $context = array()) 97 | { 98 | $this->log(LogLevel::NOTICE, $message, $context); 99 | } 100 | 101 | /** 102 | * Interesting events. 103 | * 104 | * Example: User logs in, SQL logs. 105 | * 106 | * @param string $message 107 | * @param array $context 108 | * 109 | * @return void 110 | */ 111 | public function info($message, array $context = array()) 112 | { 113 | $this->log(LogLevel::INFO, $message, $context); 114 | } 115 | 116 | /** 117 | * Detailed debug information. 118 | * 119 | * @param string $message 120 | * @param array $context 121 | * 122 | * @return void 123 | */ 124 | public function debug($message, array $context = array()) 125 | { 126 | $this->log(LogLevel::DEBUG, $message, $context); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /vendor/psr/log/Psr/Log/InvalidArgumentException.php: -------------------------------------------------------------------------------- 1 | logger = $logger; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/psr/log/Psr/Log/LoggerInterface.php: -------------------------------------------------------------------------------- 1 | log(LogLevel::EMERGENCY, $message, $context); 26 | } 27 | 28 | /** 29 | * Action must be taken immediately. 30 | * 31 | * Example: Entire website down, database unavailable, etc. This should 32 | * trigger the SMS alerts and wake you up. 33 | * 34 | * @param string $message 35 | * @param array $context 36 | * 37 | * @return void 38 | */ 39 | public function alert($message, array $context = array()) 40 | { 41 | $this->log(LogLevel::ALERT, $message, $context); 42 | } 43 | 44 | /** 45 | * Critical conditions. 46 | * 47 | * Example: Application component unavailable, unexpected exception. 48 | * 49 | * @param string $message 50 | * @param array $context 51 | * 52 | * @return void 53 | */ 54 | public function critical($message, array $context = array()) 55 | { 56 | $this->log(LogLevel::CRITICAL, $message, $context); 57 | } 58 | 59 | /** 60 | * Runtime errors that do not require immediate action but should typically 61 | * be logged and monitored. 62 | * 63 | * @param string $message 64 | * @param array $context 65 | * 66 | * @return void 67 | */ 68 | public function error($message, array $context = array()) 69 | { 70 | $this->log(LogLevel::ERROR, $message, $context); 71 | } 72 | 73 | /** 74 | * Exceptional occurrences that are not errors. 75 | * 76 | * Example: Use of deprecated APIs, poor use of an API, undesirable things 77 | * that are not necessarily wrong. 78 | * 79 | * @param string $message 80 | * @param array $context 81 | * 82 | * @return void 83 | */ 84 | public function warning($message, array $context = array()) 85 | { 86 | $this->log(LogLevel::WARNING, $message, $context); 87 | } 88 | 89 | /** 90 | * Normal but significant events. 91 | * 92 | * @param string $message 93 | * @param array $context 94 | * 95 | * @return void 96 | */ 97 | public function notice($message, array $context = array()) 98 | { 99 | $this->log(LogLevel::NOTICE, $message, $context); 100 | } 101 | 102 | /** 103 | * Interesting events. 104 | * 105 | * Example: User logs in, SQL logs. 106 | * 107 | * @param string $message 108 | * @param array $context 109 | * 110 | * @return void 111 | */ 112 | public function info($message, array $context = array()) 113 | { 114 | $this->log(LogLevel::INFO, $message, $context); 115 | } 116 | 117 | /** 118 | * Detailed debug information. 119 | * 120 | * @param string $message 121 | * @param array $context 122 | * 123 | * @return void 124 | */ 125 | public function debug($message, array $context = array()) 126 | { 127 | $this->log(LogLevel::DEBUG, $message, $context); 128 | } 129 | 130 | /** 131 | * Logs with an arbitrary level. 132 | * 133 | * @param mixed $level 134 | * @param string $message 135 | * @param array $context 136 | * 137 | * @return void 138 | */ 139 | abstract public function log($level, $message, array $context = array()); 140 | } 141 | -------------------------------------------------------------------------------- /vendor/psr/log/Psr/Log/NullLogger.php: -------------------------------------------------------------------------------- 1 | logger) { }` 11 | * blocks. 12 | */ 13 | class NullLogger extends AbstractLogger 14 | { 15 | /** 16 | * Logs with an arbitrary level. 17 | * 18 | * @param mixed $level 19 | * @param string $message 20 | * @param array $context 21 | * 22 | * @return void 23 | */ 24 | public function log($level, $message, array $context = array()) 25 | { 26 | // noop 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php: -------------------------------------------------------------------------------- 1 | ". 25 | * 26 | * Example ->error('Foo') would yield "error Foo". 27 | * 28 | * @return string[] 29 | */ 30 | abstract public function getLogs(); 31 | 32 | public function testImplements() 33 | { 34 | $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger()); 35 | } 36 | 37 | /** 38 | * @dataProvider provideLevelsAndMessages 39 | */ 40 | public function testLogsAtAllLevels($level, $message) 41 | { 42 | $logger = $this->getLogger(); 43 | $logger->{$level}($message, array('user' => 'Bob')); 44 | $logger->log($level, $message, array('user' => 'Bob')); 45 | 46 | $expected = array( 47 | $level.' message of level '.$level.' with context: Bob', 48 | $level.' message of level '.$level.' with context: Bob', 49 | ); 50 | $this->assertEquals($expected, $this->getLogs()); 51 | } 52 | 53 | public function provideLevelsAndMessages() 54 | { 55 | return array( 56 | LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), 57 | LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), 58 | LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), 59 | LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), 60 | LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), 61 | LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), 62 | LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), 63 | LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), 64 | ); 65 | } 66 | 67 | /** 68 | * @expectedException \Psr\Log\InvalidArgumentException 69 | */ 70 | public function testThrowsOnInvalidLevel() 71 | { 72 | $logger = $this->getLogger(); 73 | $logger->log('invalid level', 'Foo'); 74 | } 75 | 76 | public function testContextReplacement() 77 | { 78 | $logger = $this->getLogger(); 79 | $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); 80 | 81 | $expected = array('info {Message {nothing} Bob Bar a}'); 82 | $this->assertEquals($expected, $this->getLogs()); 83 | } 84 | 85 | public function testObjectCastToString() 86 | { 87 | if (method_exists($this, 'createPartialMock')) { 88 | $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString')); 89 | } else { 90 | $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString')); 91 | } 92 | $dummy->expects($this->once()) 93 | ->method('__toString') 94 | ->will($this->returnValue('DUMMY')); 95 | 96 | $this->getLogger()->warning($dummy); 97 | 98 | $expected = array('warning DUMMY'); 99 | $this->assertEquals($expected, $this->getLogs()); 100 | } 101 | 102 | public function testContextCanContainAnything() 103 | { 104 | $context = array( 105 | 'bool' => true, 106 | 'null' => null, 107 | 'string' => 'Foo', 108 | 'int' => 0, 109 | 'float' => 0.5, 110 | 'nested' => array('with object' => new DummyTest), 111 | 'object' => new \DateTime, 112 | 'resource' => fopen('php://memory', 'r'), 113 | ); 114 | 115 | $this->getLogger()->warning('Crazy context data', $context); 116 | 117 | $expected = array('warning Crazy context data'); 118 | $this->assertEquals($expected, $this->getLogs()); 119 | } 120 | 121 | public function testContextExceptionKeyCanBeExceptionOrOtherValues() 122 | { 123 | $logger = $this->getLogger(); 124 | $logger->warning('Random message', array('exception' => 'oops')); 125 | $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); 126 | 127 | $expected = array( 128 | 'warning Random message', 129 | 'critical Uncaught Exception!' 130 | ); 131 | $this->assertEquals($expected, $this->getLogs()); 132 | } 133 | } 134 | 135 | class DummyTest 136 | { 137 | public function __toString() 138 | { 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /vendor/psr/log/README.md: -------------------------------------------------------------------------------- 1 | PSR Log 2 | ======= 3 | 4 | This repository holds all interfaces/classes/traits related to 5 | [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md). 6 | 7 | Note that this is not a logger of its own. It is merely an interface that 8 | describes a logger. See the specification for more details. 9 | 10 | Usage 11 | ----- 12 | 13 | If you need a logger, you can use the interface like this: 14 | 15 | ```php 16 | logger = $logger; 27 | } 28 | 29 | public function doSomething() 30 | { 31 | if ($this->logger) { 32 | $this->logger->info('Doing work'); 33 | } 34 | 35 | // do something useful 36 | } 37 | } 38 | ``` 39 | 40 | You can then pick one of the implementations of the interface to get a logger. 41 | 42 | If you want to implement the interface, you can require this package and 43 | implement `Psr\Log\LoggerInterface` in your code. Please read the 44 | [specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) 45 | for details. 46 | -------------------------------------------------------------------------------- /vendor/psr/log/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "psr/log", 3 | "description": "Common interface for logging libraries", 4 | "keywords": ["psr", "psr-3", "log"], 5 | "homepage": "https://github.com/php-fig/log", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "PHP-FIG", 10 | "homepage": "http://www.php-fig.org/" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.3.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Psr\\Log\\": "Psr/Log/" 19 | } 20 | }, 21 | "extra": { 22 | "branch-alias": { 23 | "dev-master": "1.0.x-dev" 24 | } 25 | } 26 | } 27 | --------------------------------------------------------------------------------