diff --git a/.travis.yml b/.travis.yml index 476007c..807d6ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: php php: - "5.4" - - "5.3" \ No newline at end of file + - "5.3" + - "5.5" + - hhvm \ No newline at end of file diff --git a/README.md b/README.md index 231476c..2bd23ca 100755 --- a/README.md +++ b/README.md @@ -10,19 +10,19 @@ require '/src/Ctct/autoload.php' ``` -### Composer +### Installing via Composer Composer is a dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project. In order to use the Constant Contact PHP SDK through composer, you must do the following 1. Add "constantcontact/constantcontact" as a dependency in your project's composer.json file. ```javascript { "require": { - "constantcontact/constantcontact": "1.0.*" + "constantcontact/constantcontact": "1.1.*" } } ``` -2. Downoad and Install Composer. +2. Download and Install Composer. ``` curl -s "http://getcomposer.org/installer" | php ``` @@ -41,7 +41,7 @@ require 'vendor/autoload.php'; ## Usage Once either the composer or built in autoloader has been required, you can begin using the SDK. ```php -use Ctct/ConstantContact; +use Ctct\ConstantContact; $cc = new ConstantContact('your api key'); $contacts = $cc->getContacts('your access token') diff --git a/composer.json b/composer.json index cf4d788..a581533 100755 --- a/composer.json +++ b/composer.json @@ -16,9 +16,9 @@ "homepage": "http://developer.constantcontact.com" } ], - "autoload":{ - "psr-0": { + "autoload": { + "psr-0": { "Ctct": "src" - } + } } } \ No newline at end of file diff --git a/docs/404.html b/docs/404.html deleted file mode 100644 index 22d8f9d..0000000 --- a/docs/404.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - Page not found | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Auth.CtctDataStore.html b/docs/class-Ctct.Auth.CtctDataStore.html deleted file mode 100644 index a768d3d..0000000 --- a/docs/class-Ctct.Auth.CtctDataStore.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - Interface Ctct\Auth\CtctDataStore | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Auth.CtctOAuth2.html b/docs/class-Ctct.Auth.CtctOAuth2.html deleted file mode 100644 index 09c295b..0000000 --- a/docs/class-Ctct.Auth.CtctOAuth2.html +++ /dev/null @@ -1,376 +0,0 @@ - - - - - - - Class Ctct\Auth\CtctOAuth2 | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Auth.SessionDataStore.html b/docs/class-Ctct.Auth.SessionDataStore.html deleted file mode 100644 index 2b80bf5..0000000 --- a/docs/class-Ctct.Auth.SessionDataStore.html +++ /dev/null @@ -1,385 +0,0 @@ - - - - - - - Class Ctct\Auth\SessionDataStore | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Account.VerifiedEmailAddress.html b/docs/class-Ctct.Components.Account.VerifiedEmailAddress.html deleted file mode 100644 index de5c300..0000000 --- a/docs/class-Ctct.Components.Account.VerifiedEmailAddress.html +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - - Class Ctct\Components\Account\VerifiedEmailAddress | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Activities.Activity.html b/docs/class-Ctct.Components.Activities.Activity.html deleted file mode 100644 index 76bfebd..0000000 --- a/docs/class-Ctct.Components.Activities.Activity.html +++ /dev/null @@ -1,522 +0,0 @@ - - - - - - - Class Ctct\Components\Activities\Activity | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Activities.ActivityError.html b/docs/class-Ctct.Components.Activities.ActivityError.html deleted file mode 100644 index c0cb184..0000000 --- a/docs/class-Ctct.Components.Activities.ActivityError.html +++ /dev/null @@ -1,297 +0,0 @@ - - - - - - - Class Ctct\Components\Activities\ActivityError | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Activities.AddContacts.html b/docs/class-Ctct.Components.Activities.AddContacts.html deleted file mode 100644 index eae34c8..0000000 --- a/docs/class-Ctct.Components.Activities.AddContacts.html +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - Class Ctct\Components\Activities\AddContacts | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Activities.AddContactsImportData.html b/docs/class-Ctct.Components.Activities.AddContactsImportData.html deleted file mode 100644 index 26eefef..0000000 --- a/docs/class-Ctct.Components.Activities.AddContactsImportData.html +++ /dev/null @@ -1,576 +0,0 @@ - - - - - - - Class Ctct\Components\Activities\AddContactsImportData | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Activities.ExportContacts.html b/docs/class-Ctct.Components.Activities.ExportContacts.html deleted file mode 100644 index 59fb021..0000000 --- a/docs/class-Ctct.Components.Activities.ExportContacts.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - - Class Ctct\Components\Activities\ExportContacts | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Component.html b/docs/class-Ctct.Components.Component.html deleted file mode 100644 index efa2427..0000000 --- a/docs/class-Ctct.Components.Component.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - Class Ctct\Components\Component | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Contacts.Address.html b/docs/class-Ctct.Components.Contacts.Address.html deleted file mode 100644 index cdb8f40..0000000 --- a/docs/class-Ctct.Components.Contacts.Address.html +++ /dev/null @@ -1,473 +0,0 @@ - - - - - - - Class Ctct\Components\Contacts\Address | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Contacts.Contact.html b/docs/class-Ctct.Components.Contacts.Contact.html deleted file mode 100644 index 429f003..0000000 --- a/docs/class-Ctct.Components.Contacts.Contact.html +++ /dev/null @@ -1,954 +0,0 @@ - - - - - - - Class Ctct\Components\Contacts\Contact | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Contacts.ContactList.html b/docs/class-Ctct.Components.Contacts.ContactList.html deleted file mode 100644 index 87c63ce..0000000 --- a/docs/class-Ctct.Components.Contacts.ContactList.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - - - Class Ctct\Components\Contacts\ContactList | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Contacts.CustomField.html b/docs/class-Ctct.Components.Contacts.CustomField.html deleted file mode 100644 index 0a16988..0000000 --- a/docs/class-Ctct.Components.Contacts.CustomField.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - - - - Class Ctct\Components\Contacts\CustomField | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Contacts.EmailAddress.html b/docs/class-Ctct.Components.Contacts.EmailAddress.html deleted file mode 100644 index 8458556..0000000 --- a/docs/class-Ctct.Components.Contacts.EmailAddress.html +++ /dev/null @@ -1,428 +0,0 @@ - - - - - - - Class Ctct\Components\Contacts\EmailAddress | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Contacts.Note.html b/docs/class-Ctct.Components.Contacts.Note.html deleted file mode 100644 index 63ba27e..0000000 --- a/docs/class-Ctct.Components.Contacts.Note.html +++ /dev/null @@ -1,312 +0,0 @@ - - - - - - - Class Ctct\Components\Contacts\Note | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.EmailMarketing.Campaign.html b/docs/class-Ctct.Components.EmailMarketing.Campaign.html deleted file mode 100644 index dca776f..0000000 --- a/docs/class-Ctct.Components.EmailMarketing.Campaign.html +++ /dev/null @@ -1,1125 +0,0 @@ - - - - - - - Class Ctct\Components\EmailMarketing\Campaign | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.EmailMarketing.ClickThroughDetails.html b/docs/class-Ctct.Components.EmailMarketing.ClickThroughDetails.html deleted file mode 100644 index 15e437f..0000000 --- a/docs/class-Ctct.Components.EmailMarketing.ClickThroughDetails.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - Class Ctct\Components\EmailMarketing\ClickThroughDetails | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.EmailMarketing.MessageFooter.html b/docs/class-Ctct.Components.EmailMarketing.MessageFooter.html deleted file mode 100644 index f1f4a57..0000000 --- a/docs/class-Ctct.Components.EmailMarketing.MessageFooter.html +++ /dev/null @@ -1,529 +0,0 @@ - - - - - - - Class Ctct\Components\EmailMarketing\MessageFooter | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.EmailMarketing.Schedule.html b/docs/class-Ctct.Components.EmailMarketing.Schedule.html deleted file mode 100644 index a218bb7..0000000 --- a/docs/class-Ctct.Components.EmailMarketing.Schedule.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - - - - Class Ctct\Components\EmailMarketing\Schedule | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.EmailMarketing.TestSend.html b/docs/class-Ctct.Components.EmailMarketing.TestSend.html deleted file mode 100644 index 25f4975..0000000 --- a/docs/class-Ctct.Components.EmailMarketing.TestSend.html +++ /dev/null @@ -1,388 +0,0 @@ - - - - - - - Class Ctct\Components\EmailMarketing\TestSend | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.ResultSet.html b/docs/class-Ctct.Components.ResultSet.html deleted file mode 100644 index 678e30b..0000000 --- a/docs/class-Ctct.Components.ResultSet.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - - Class Ctct\Components\ResultSet | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Tracking.BounceActivity.html b/docs/class-Ctct.Components.Tracking.BounceActivity.html deleted file mode 100644 index 64498a6..0000000 --- a/docs/class-Ctct.Components.Tracking.BounceActivity.html +++ /dev/null @@ -1,417 +0,0 @@ - - - - - - - Class Ctct\Components\Tracking\BounceActivity | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Tracking.ClickActivity.html b/docs/class-Ctct.Components.Tracking.ClickActivity.html deleted file mode 100644 index 0773b0e..0000000 --- a/docs/class-Ctct.Components.Tracking.ClickActivity.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - Class Ctct\Components\Tracking\ClickActivity | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Tracking.ForwardActivity.html b/docs/class-Ctct.Components.Tracking.ForwardActivity.html deleted file mode 100644 index 7574148..0000000 --- a/docs/class-Ctct.Components.Tracking.ForwardActivity.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - Class Ctct\Components\Tracking\ForwardActivity | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Tracking.OpenActivity.html b/docs/class-Ctct.Components.Tracking.OpenActivity.html deleted file mode 100644 index 6fad473..0000000 --- a/docs/class-Ctct.Components.Tracking.OpenActivity.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - Class Ctct\Components\Tracking\OpenActivity | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Tracking.OptOutActivity.html b/docs/class-Ctct.Components.Tracking.OptOutActivity.html deleted file mode 100644 index af26098..0000000 --- a/docs/class-Ctct.Components.Tracking.OptOutActivity.html +++ /dev/null @@ -1,394 +0,0 @@ - - - - - - - Class Ctct\Components\Tracking\OptOutActivity | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Tracking.SendActivity.html b/docs/class-Ctct.Components.Tracking.SendActivity.html deleted file mode 100644 index eb2847e..0000000 --- a/docs/class-Ctct.Components.Tracking.SendActivity.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - Class Ctct\Components\Tracking\SendActivity | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Tracking.TrackingActivity.html b/docs/class-Ctct.Components.Tracking.TrackingActivity.html deleted file mode 100644 index 8e2d985..0000000 --- a/docs/class-Ctct.Components.Tracking.TrackingActivity.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - - Class Ctct\Components\Tracking\TrackingActivity | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Components.Tracking.TrackingSummary.html b/docs/class-Ctct.Components.Tracking.TrackingSummary.html deleted file mode 100644 index de9ff57..0000000 --- a/docs/class-Ctct.Components.Tracking.TrackingSummary.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - Class Ctct\Components\Tracking\TrackingSummary | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.ConstantContact.html b/docs/class-Ctct.ConstantContact.html deleted file mode 100644 index 66609dd..0000000 --- a/docs/class-Ctct.ConstantContact.html +++ /dev/null @@ -1,2244 +0,0 @@ - - - - - - - Class Ctct\ConstantContact | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Exceptions.CtctException.html b/docs/class-Ctct.Exceptions.CtctException.html deleted file mode 100644 index 7645e25..0000000 --- a/docs/class-Ctct.Exceptions.CtctException.html +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - - Class Ctct\Exceptions\CtctException | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Exceptions.IllegalArgumentException.html b/docs/class-Ctct.Exceptions.IllegalArgumentException.html deleted file mode 100644 index 0e1e001..0000000 --- a/docs/class-Ctct.Exceptions.IllegalArgumentException.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - Class Ctct\Exceptions\IllegalArgumentException | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Exceptions.OAuth2Exception.html b/docs/class-Ctct.Exceptions.OAuth2Exception.html deleted file mode 100644 index a4f7fc6..0000000 --- a/docs/class-Ctct.Exceptions.OAuth2Exception.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - Class Ctct\Exceptions\OAuth2Exception | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Services.AccountService.html b/docs/class-Ctct.Services.AccountService.html deleted file mode 100644 index 79b37a8..0000000 --- a/docs/class-Ctct.Services.AccountService.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - - Class Ctct\Services\AccountService | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Services.ActivityService.html b/docs/class-Ctct.Services.ActivityService.html deleted file mode 100644 index e50c71e..0000000 --- a/docs/class-Ctct.Services.ActivityService.html +++ /dev/null @@ -1,465 +0,0 @@ - - - - - - - Class Ctct\Services\ActivityService | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Services.BaseService.html b/docs/class-Ctct.Services.BaseService.html deleted file mode 100644 index 2c7ad72..0000000 --- a/docs/class-Ctct.Services.BaseService.html +++ /dev/null @@ -1,399 +0,0 @@ - - - - - - - Class Ctct\Services\BaseService | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Services.CampaignScheduleService.html b/docs/class-Ctct.Services.CampaignScheduleService.html deleted file mode 100644 index 6f08973..0000000 --- a/docs/class-Ctct.Services.CampaignScheduleService.html +++ /dev/null @@ -1,475 +0,0 @@ - - - - - - - Class Ctct\Services\CampaignScheduleService | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Services.CampaignTrackingService.html b/docs/class-Ctct.Services.CampaignTrackingService.html deleted file mode 100644 index 4ec36d0..0000000 --- a/docs/class-Ctct.Services.CampaignTrackingService.html +++ /dev/null @@ -1,521 +0,0 @@ - - - - - - - Class Ctct\Services\CampaignTrackingService | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Services.ContactService.html b/docs/class-Ctct.Services.ContactService.html deleted file mode 100644 index 2c11743..0000000 --- a/docs/class-Ctct.Services.ContactService.html +++ /dev/null @@ -1,515 +0,0 @@ - - - - - - - Class Ctct\Services\ContactService | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Services.ContactTrackingService.html b/docs/class-Ctct.Services.ContactTrackingService.html deleted file mode 100644 index 7dfc74a..0000000 --- a/docs/class-Ctct.Services.ContactTrackingService.html +++ /dev/null @@ -1,521 +0,0 @@ - - - - - - - Class Ctct\Services\ContactTrackingService | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Services.EmailMarketingService.html b/docs/class-Ctct.Services.EmailMarketingService.html deleted file mode 100644 index a34f7ba..0000000 --- a/docs/class-Ctct.Services.EmailMarketingService.html +++ /dev/null @@ -1,421 +0,0 @@ - - - - - - - Class Ctct\Services\EmailMarketingService | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.Services.ListService.html b/docs/class-Ctct.Services.ListService.html deleted file mode 100644 index 696701a..0000000 --- a/docs/class-Ctct.Services.ListService.html +++ /dev/null @@ -1,421 +0,0 @@ - - - - - - - Class Ctct\Services\ListService | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Ctct.SplClassLoader.html b/docs/class-Ctct.SplClassLoader.html deleted file mode 100644 index cff9e3c..0000000 --- a/docs/class-Ctct.SplClassLoader.html +++ /dev/null @@ -1,560 +0,0 @@ - - - - - - - Class Ctct\SplClassLoader | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/class-Exception.html b/docs/class-Exception.html deleted file mode 100644 index 63310e1..0000000 --- a/docs/class-Exception.html +++ /dev/null @@ -1,514 +0,0 @@ - - - - - - - Class Exception | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/elementlist.js b/docs/elementlist.js deleted file mode 100644 index a3bf6a6..0000000 --- a/docs/elementlist.js +++ /dev/null @@ -1,3 +0,0 @@ - -var ApiGen = ApiGen || {}; -ApiGen.elements = [["c","Ctct\\Auth\\CtctDataStore"],["c","Ctct\\Auth\\CtctOAuth2"],["c","Ctct\\Auth\\SessionDataStore"],["c","Ctct\\Components\\Account\\VerifiedEmailAddress"],["c","Ctct\\Components\\Activities\\Activity"],["c","Ctct\\Components\\Activities\\ActivityError"],["c","Ctct\\Components\\Activities\\AddContacts"],["c","Ctct\\Components\\Activities\\AddContactsImportData"],["c","Ctct\\Components\\Activities\\ExportContacts"],["c","Ctct\\Components\\Component"],["c","Ctct\\Components\\Contacts\\Address"],["c","Ctct\\Components\\Contacts\\Contact"],["c","Ctct\\Components\\Contacts\\ContactList"],["c","Ctct\\Components\\Contacts\\CustomField"],["c","Ctct\\Components\\Contacts\\EmailAddress"],["c","Ctct\\Components\\Contacts\\Note"],["c","Ctct\\Components\\EmailMarketing\\Campaign"],["c","Ctct\\Components\\EmailMarketing\\ClickThroughDetails"],["c","Ctct\\Components\\EmailMarketing\\MessageFooter"],["c","Ctct\\Components\\EmailMarketing\\Schedule"],["c","Ctct\\Components\\EmailMarketing\\TestSend"],["c","Ctct\\Components\\ResultSet"],["c","Ctct\\Components\\Tracking\\BounceActivity"],["c","Ctct\\Components\\Tracking\\ClickActivity"],["c","Ctct\\Components\\Tracking\\ForwardActivity"],["c","Ctct\\Components\\Tracking\\OpenActivity"],["c","Ctct\\Components\\Tracking\\OptOutActivity"],["c","Ctct\\Components\\Tracking\\SendActivity"],["c","Ctct\\Components\\Tracking\\TrackingActivity"],["c","Ctct\\Components\\Tracking\\TrackingSummary"],["c","Ctct\\ConstantContact"],["c","Ctct\\Exceptions\\CtctException"],["c","Ctct\\Exceptions\\IllegalArgumentException"],["c","Ctct\\Exceptions\\OAuth2Exception"],["c","Ctct\\Services\\AccountService"],["c","Ctct\\Services\\ActivityService"],["c","Ctct\\Services\\BaseService"],["c","Ctct\\Services\\CampaignScheduleService"],["c","Ctct\\Services\\CampaignTrackingService"],["c","Ctct\\Services\\ContactService"],["c","Ctct\\Services\\ContactTrackingService"],["c","Ctct\\Services\\EmailMarketingService"],["c","Ctct\\Services\\ListService"],["c","Ctct\\SplClassLoader"],["c","Exception"]]; diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index f6cfdf7..0000000 --- a/docs/index.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/namespace-Ctct.Auth.html b/docs/namespace-Ctct.Auth.html deleted file mode 100644 index 0294210..0000000 --- a/docs/namespace-Ctct.Auth.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - Namespace Ctct\Auth | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/namespace-Ctct.Components.Account.html b/docs/namespace-Ctct.Components.Account.html deleted file mode 100644 index adeaaf4..0000000 --- a/docs/namespace-Ctct.Components.Account.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - Namespace Ctct\Components\Account | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/namespace-Ctct.Components.Activities.html b/docs/namespace-Ctct.Components.Activities.html deleted file mode 100644 index 04f8ff0..0000000 --- a/docs/namespace-Ctct.Components.Activities.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - Namespace Ctct\Components\Activities | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/namespace-Ctct.Components.Contacts.html b/docs/namespace-Ctct.Components.Contacts.html deleted file mode 100644 index d0c084d..0000000 --- a/docs/namespace-Ctct.Components.Contacts.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - Namespace Ctct\Components\Contacts | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/namespace-Ctct.Components.EmailMarketing.html b/docs/namespace-Ctct.Components.EmailMarketing.html deleted file mode 100644 index 0668024..0000000 --- a/docs/namespace-Ctct.Components.EmailMarketing.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - Namespace Ctct\Components\EmailMarketing | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/namespace-Ctct.Components.Tracking.html b/docs/namespace-Ctct.Components.Tracking.html deleted file mode 100644 index be6617c..0000000 --- a/docs/namespace-Ctct.Components.Tracking.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - Namespace Ctct\Components\Tracking | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/namespace-Ctct.Components.html b/docs/namespace-Ctct.Components.html deleted file mode 100644 index f3a693a..0000000 --- a/docs/namespace-Ctct.Components.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - Namespace Ctct\Components | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/namespace-Ctct.Exceptions.html b/docs/namespace-Ctct.Exceptions.html deleted file mode 100644 index e5bf769..0000000 --- a/docs/namespace-Ctct.Exceptions.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - Namespace Ctct\Exceptions | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/namespace-Ctct.Services.html b/docs/namespace-Ctct.Services.html deleted file mode 100644 index ea5111e..0000000 --- a/docs/namespace-Ctct.Services.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - Namespace Ctct\Services | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/namespace-Ctct.html b/docs/namespace-Ctct.html deleted file mode 100644 index 75e05cc..0000000 --- a/docs/namespace-Ctct.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - Namespace Ctct | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/namespace-PHP.html b/docs/namespace-PHP.html deleted file mode 100644 index 30f7b9f..0000000 --- a/docs/namespace-PHP.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - Namespace PHP | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/resources/collapsed.png b/docs/resources/collapsed.png deleted file mode 100644 index 56e7323..0000000 Binary files a/docs/resources/collapsed.png and /dev/null differ diff --git a/docs/resources/combined.js b/docs/resources/combined.js deleted file mode 100644 index 4076fff..0000000 --- a/docs/resources/combined.js +++ /dev/null @@ -1,1264 +0,0 @@ - -var ApiGen = ApiGen || {}; -ApiGen.config = {"require":{"min":"2.8.0"},"resources":{"resources":"resources"},"templates":{"common":{"overview.latte":"index.html","combined.js.latte":"resources\/combined.js","elementlist.js.latte":"elementlist.js","404.latte":"404.html"},"optional":{"sitemap":{"filename":"sitemap.xml","template":"sitemap.xml.latte"},"opensearch":{"filename":"opensearch.xml","template":"opensearch.xml.latte"},"robots":{"filename":"robots.txt","template":"robots.txt.latte"}},"main":{"package":{"filename":"package-%s.html","template":"package.latte"},"namespace":{"filename":"namespace-%s.html","template":"namespace.latte"},"class":{"filename":"class-%s.html","template":"class.latte"},"constant":{"filename":"constant-%s.html","template":"constant.latte"},"function":{"filename":"function-%s.html","template":"function.latte"},"source":{"filename":"source-%s.html","template":"source.latte"},"tree":{"filename":"tree.html","template":"tree.latte"},"deprecated":{"filename":"deprecated.html","template":"deprecated.latte"},"todo":{"filename":"todo.html","template":"todo.latte"}}},"options":{"elementDetailsCollapsed":true,"elementsOrder":"natural"},"config":"\/usr\/local\/data\/ApiGen\/templates\/default\/config.neon"}; - - -/*! jQuery v1.7 jquery.com | jquery.org/license */ -(function(a,b){function cA(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cx(a){if(!cm[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cn||(cn=c.createElement("iframe"),cn.frameBorder=cn.width=cn.height=0),b.appendChild(cn);if(!co||!cn.createElement)co=(cn.contentWindow||cn.contentDocument).document,co.write((c.compatMode==="CSS1Compat"?"":"")+""),co.close();d=co.createElement(a),co.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cn)}cm[a]=e}return cm[a]}function cw(a,b){var c={};f.each(cs.concat.apply([],cs.slice(0,b)),function(){c[this]=a});return c}function cv(){ct=b}function cu(){setTimeout(cv,0);return ct=f.now()}function cl(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ck(){try{return new a.XMLHttpRequest}catch(b){}}function ce(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bB(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function br(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bi,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bq(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bp(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bp)}function bp(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bo(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bn(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bm(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(){return!0}function M(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.add(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;B.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return a!=null&&m.test(a)&&!isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,unknownElems:!!a.getElementsByTagName("nav").length,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",enctype:!!c.createElement("form").enctype,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.lastChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-999px",top:"-999px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
t
",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;f(function(){var a,b,d,e,g,h,i=1,j="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",l="visibility:hidden;border:0;",n="style='"+j+"border:5px solid #000;padding:0;'",p="
"+""+"
";m=c.getElementsByTagName("body")[0];!m||(a=c.createElement("div"),a.style.cssText=l+"width:0;height:0;position:static;top:0;margin-top:"+i+"px",m.insertBefore(a,m.firstChild),o=c.createElement("div"),o.style.cssText=j+l,o.innerHTML=p,a.appendChild(o),b=o.firstChild,d=b.firstChild,g=b.nextSibling.firstChild.firstChild,h={doesNotAddBorder:d.offsetTop!==5,doesAddBorderForTableAndCells:g.offsetTop===5},d.style.position="fixed",d.style.top="20px",h.fixedPosition=d.offsetTop===20||d.offsetTop===15,d.style.position=d.style.top="",b.style.overflow="hidden",b.style.position="relative",h.subtractsBorderForOverflowNotVisible=d.offsetTop===-5,h.doesNotIncludeMarginInBodyOffset=m.offsetTop!==i,m.removeChild(a),o=a=null,f.extend(k,h))}),o.innerHTML="",n.removeChild(o),o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[f.expando]:a[f.expando]&&f.expando,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[f.expando]=n=++f.uuid:n=f.expando),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[f.expando]:f.expando;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)?b=b:b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" "));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];if(!arguments.length){if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}return b}e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!a||j===3||j===8||j===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g},removeAttr:function(a,b){var c,d,e,g,h=0;if(a.nodeType===1){d=(b||"").split(p),g=d.length;for(;h=0}})});var z=/\.(.*)$/,A=/^(?:textarea|input|select)$/i,B=/\./g,C=/ /g,D=/[^\w\s.|`]/g,E=/^([^\.]*)?(?:\.(.+))?$/,F=/\bhover(\.\S+)?/,G=/^key/,H=/^(?:mouse|contextmenu)|click/,I=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,J=function(a){var b=I.exec(a);b&& -(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},K=function(a,b){return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||a.id===b[2])&&(!b[3]||b[3].test(a.className))},L=function(a){return f.event.special.hover?a:a.replace(F,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=L(c).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"",(g||!e)&&c.preventDefault();if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,n=null;for(m=e.parentNode;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l=0:t===b&&(t=o[s]=r.quick?K(m,r.quick):f(m).is(s)),t&&q.push(r);q.length&&j.push({elem:m,matches:q})}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),G.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),H.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",Z=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,_=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,ba=/<([\w:]+)/,bb=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bk=X(c);bj.optgroup=bj.option,bj.tbody=bj.tfoot=bj.colgroup=bj.caption=bj.thead,bj.th=bj.td,f.support.htmlSerialize||(bj._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after" -,arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Z,""):null;if(typeof a=="string"&&!bd.test(a)&&(f.support.leadingWhitespace||!$.test(a))&&!bj[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(_,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bn(a,d),e=bo(a),g=bo(d);for(h=0;e[h];++h)g[h]&&bn(e[h],g[h])}if(b){bm(a,d);if(c){e=bo(a),g=bo(d);for(h=0;e[h];++h)bm(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bc.test(k))k=b.createTextNode(k);else{k=k.replace(_,"<$1>");var l=(ba.exec(k)||["",""])[1].toLowerCase(),m=bj[l]||bj._default,n=m[0],o=b.createElement("div");b===c?bk.appendChild(o):X(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=bb.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&$.test(k)&&o.insertBefore(b.createTextNode($.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bt.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bs,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bs.test(g)?g.replace(bs,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bB(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bC=function(a,c){var d,e,g;c=c.replace(bu,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bD=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bv.test(f)&&bw.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bB=bC||bD,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bF=/%20/g,bG=/\[\]$/,bH=/\r?\n/g,bI=/#.*$/,bJ=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bK=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bL=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bM=/^(?:GET|HEAD)$/,bN=/^\/\//,bO=/\?/,bP=/)<[^<]*)*<\/script>/gi,bQ=/^(?:select|textarea)/i,bR=/\s+/,bS=/([?&])_=[^&]*/,bT=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bU=f.fn.load,bV={},bW={},bX,bY,bZ=["*/"]+["*"];try{bX=e.href}catch(b$){bX=c.createElement("a"),bX.href="",bX=bX.href}bY=bT.exec(bX.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bU)return bU.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bP,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bQ.test(this.nodeName)||bK.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bH,"\r\n")}}):{name:b.name,value:c.replace(bH,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?cb(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),cb(a,b);return a},ajaxSettings:{url:bX,isLocal:bL.test(bY[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bZ},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:b_(bV),ajaxTransport:b_(bW),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cd(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=ce(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bJ.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bI,"").replace(bN,bY[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bR),d.crossDomain==null&&(r=bT.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bY[1]&&r[2]==bY[2]&&(r[3]||(r[1]==="http:"?80:443))==(bY[3]||(bY[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),ca(bV,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bM.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bO.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bS,"$1_="+x);d.url=y+(y===d.url?(bO.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bZ+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=ca(bW,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)cc(g,a[g],c,e);return d.join("&").replace(bF,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cf=f.now(),cg=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cf++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cg.test(b.url)||e&&cg.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cg,l),b.url===j&&(e&&(k=k.replace(cg,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ch=a.ActiveXObject?function(){for(var a in cj)cj[a](0,1)}:!1,ci=0,cj;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ck()||cl()}:ck,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ch&&delete cj[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++ci,ch&&(cj||(cj={},f(a).unload(ch)),cj[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cm={},cn,co,cp=/^(?:toggle|show|hide)$/,cq=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cr,cs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],ct;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cw("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cz.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cz.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cA(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cA(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); -/** - * Cookie plugin - * - * Copyright (c) 2006 Klaus Hartl (stilbuero.de) - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - */ - -/** - * Create a cookie with the given name and value and other optional parameters. - * - * @example $.cookie('the_cookie', 'the_value'); - * @desc Set the value of a cookie. - * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); - * @desc Create a cookie with all available options. - * @example $.cookie('the_cookie', 'the_value'); - * @desc Create a session cookie. - * @example $.cookie('the_cookie', null); - * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain - * used when the cookie was set. - * - * @param String name The name of the cookie. - * @param String value The value of the cookie. - * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. - * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. - * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. - * If set to null or omitted, the cookie will be a session cookie and will not be retained - * when the the browser exits. - * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). - * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). - * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will - * require a secure protocol (like HTTPS). - * @type undefined - * - * @name $.cookie - * @cat Plugins/Cookie - * @author Klaus Hartl/klaus.hartl@stilbuero.de - */ - -/** - * Get the value of a cookie with the given name. - * - * @example $.cookie('the_cookie'); - * @desc Get the value of a cookie. - * - * @param String name The name of the cookie. - * @return The value of the cookie. - * @type String - * - * @name $.cookie - * @cat Plugins/Cookie - * @author Klaus Hartl/klaus.hartl@stilbuero.de - */ -jQuery.cookie = function(name, value, options) { - if (typeof value != 'undefined') { // name and value given, set cookie - options = options || {}; - if (value === null) { - value = ''; - options.expires = -1; - } - var expires = ''; - if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { - var date; - if (typeof options.expires == 'number') { - date = new Date(); - date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); - } else { - date = options.expires; - } - expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE - } - // CAUTION: Needed to parenthesize options.path and options.domain - // in the following expressions, otherwise they evaluate to undefined - // in the packed version for some reason... - var path = options.path ? '; path=' + (options.path) : ''; - var domain = options.domain ? '; domain=' + (options.domain) : ''; - var secure = options.secure ? '; secure' : ''; - document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); - } else { // only name given, get cookie - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; - } -}; -/*! - * sprintf and vsprintf for jQuery - * somewhat based on http://jan.moesen.nu/code/javascript/sprintf-and-printf-in-javascript/ - * Copyright (c) 2008 Sabin Iacob (m0n5t3r) - * @license http://www.gnu.org/licenses/gpl.html - * @project jquery.sprintf - */ -(function(d){var a={b:function(e){return parseInt(e,10).toString(2)},c:function(e){return String.fromCharCode(parseInt(e,10))},d:function(e){return parseInt(e,10)},u:function(e){return Math.abs(e)},f:function(f,e){e=parseInt(e,10);f=parseFloat(f);if(isNaN(e&&f)){return NaN}return e&&f.toFixed(e)||f},o:function(e){return parseInt(e,10).toString(8)},s:function(e){return e},x:function(e){return(""+parseInt(e,10).toString(16)).toLowerCase()},X:function(e){return(""+parseInt(e,10).toString(16)).toUpperCase()}};var c=/%(?:(\d+)?(?:\.(\d+))?|\(([^)]+)\))([%bcdufosxX])/g;var b=function(f){if(f.length==1&&typeof f[0]=="object"){f=f[0];return function(i,h,k,j,g,m,l){return a[g](f[j])}}else{var e=0;return function(i,h,k,j,g,m,l){if(g=="%"){return"%"}return a[g](f[e++],k)}}};d.extend({sprintf:function(f){var e=Array.apply(null,arguments).slice(1);return f.replace(c,b(e))},vsprintf:function(f,e){return f.replace(c,b(e))}})})(jQuery); - -/*! - * jQuery Autocomplete plugin 1.1 - * - * Copyright (c) 2009 Jörn Zaefferer - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $ - */ - -;(function($) { - -$.fn.extend({ - autocomplete: function(urlOrData, options) { - var isUrl = typeof urlOrData == "string"; - options = $.extend({}, $.Autocompleter.defaults, { - url: isUrl ? urlOrData : null, - data: isUrl ? null : urlOrData, - delay: isUrl ? $.Autocompleter.defaults.delay : 10, - max: options && !options.scroll ? 10 : 150 - }, options); - - // if highlight is set to false, replace it with a do-nothing function - options.highlight = options.highlight || function(value) { return value; }; - - // if the formatMatch option is not specified, then use formatItem for backwards compatibility - options.formatMatch = options.formatMatch || options.formatItem; - - options.show = options.show || function(list) {}; - - return this.each(function() { - new $.Autocompleter(this, options); - }); - }, - result: function(handler) { - return this.bind("result", handler); - }, - search: function(handler) { - return this.trigger("search", [handler]); - }, - flushCache: function() { - return this.trigger("flushCache"); - }, - setOptions: function(options){ - return this.trigger("setOptions", [options]); - }, - unautocomplete: function() { - return this.trigger("unautocomplete"); - } -}); - -$.Autocompleter = function(input, options) { - - var KEY = { - UP: 38, - DOWN: 40, - DEL: 46, - TAB: 9, - RETURN: 13, - ESC: 27, - COMMA: 188, - PAGEUP: 33, - PAGEDOWN: 34, - BACKSPACE: 8 - }; - - // Create $ object for input element - var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); - - var timeout; - var previousValue = ""; - var cache = $.Autocompleter.Cache(options); - var hasFocus = 0; - var lastKeyPressCode; - var config = { - mouseDownOnSelect: false - }; - var select = $.Autocompleter.Select(options, input, selectCurrent, config); - - // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all - $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { - // a keypress means the input has focus - // avoids issue where input had focus before the autocomplete was applied - hasFocus = 1; - // track last key pressed - lastKeyPressCode = event.keyCode; - switch(event.keyCode) { - - case KEY.UP: - event.preventDefault(); - if ( select.visible() ) { - select.prev(); - } else { - onChange(0, true); - } - break; - - case KEY.DOWN: - event.preventDefault(); - if ( select.visible() ) { - select.next(); - } else { - onChange(0, true); - } - break; - - case KEY.PAGEUP: - event.preventDefault(); - if ( select.visible() ) { - select.pageUp(); - } else { - onChange(0, true); - } - break; - - case KEY.PAGEDOWN: - event.preventDefault(); - if ( select.visible() ) { - select.pageDown(); - } else { - onChange(0, true); - } - break; - - // matches also semicolon - case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: - case KEY.TAB: - case KEY.RETURN: - if( selectCurrent() ) { - //event.preventDefault(); - //return false; - } - break; - - case KEY.ESC: - select.hide(); - break; - - default: - clearTimeout(timeout); - timeout = setTimeout(onChange, options.delay); - break; - } - }).focus(function(){ - // track whether the field has focus, we shouldn't process any - // results if the field no longer has focus - hasFocus++; - }).blur(function() { - hasFocus = 0; - if (!config.mouseDownOnSelect) { - hideResults(); - } - }).click(function() { - // show select when clicking in a focused field - if ( hasFocus++ > 1 && !select.visible() ) { - onChange(0, true); - } - }).bind("search", function() { - // TODO why not just specifying both arguments? - var fn = (arguments.length > 1) ? arguments[1] : null; - function findValueCallback(q, data) { - var result; - if( data && data.length ) { - for (var i=0; i < data.length; i++) { - if( data[i].result.toLowerCase() == q.toLowerCase() ) { - result = data[i]; - break; - } - } - } - if( typeof fn == "function" ) fn(result); - else $input.trigger("result", result && [result.data, result.value]); - } - $.each(trimWords($input.val()), function(i, value) { - request(value, findValueCallback, findValueCallback); - }); - }).bind("flushCache", function() { - cache.flush(); - }).bind("setOptions", function() { - $.extend(options, arguments[1]); - // if we've updated the data, repopulate - if ( "data" in arguments[1] ) - cache.populate(); - }).bind("unautocomplete", function() { - select.unbind(); - $input.unbind(); - $(input.form).unbind(".autocomplete"); - }); - - - function selectCurrent() { - var selected = select.selected(); - if( !selected ) - return false; - - var v = selected.result; - previousValue = v; - - if ( options.multiple ) { - var words = trimWords($input.val()); - if ( words.length > 1 ) { - var seperator = options.multipleSeparator.length; - var cursorAt = $(input).selection().start; - var wordAt, progress = 0; - $.each(words, function(i, word) { - progress += word.length; - if (cursorAt <= progress) { - wordAt = i; - return false; - } - progress += seperator; - }); - words[wordAt] = v; - // TODO this should set the cursor to the right position, but it gets overriden somewhere - //$.Autocompleter.Selection(input, progress + seperator, progress + seperator); - v = words.join( options.multipleSeparator ); - } - v += options.multipleSeparator; - } - - $input.val(v); - hideResultsNow(); - $input.trigger("result", [selected.data, selected.value]); - return true; - } - - function onChange(crap, skipPrevCheck) { - if( lastKeyPressCode == KEY.DEL ) { - select.hide(); - return; - } - - var currentValue = $input.val(); - - if ( !skipPrevCheck && currentValue == previousValue ) - return; - - previousValue = currentValue; - - currentValue = lastWord(currentValue); - if ( currentValue.length >= options.minChars) { - $input.addClass(options.loadingClass); - if (!options.matchCase) - currentValue = currentValue.toLowerCase(); - request(currentValue, receiveData, hideResultsNow); - } else { - stopLoading(); - select.hide(); - } - }; - - function trimWords(value) { - if (!value) - return [""]; - if (!options.multiple) - return [$.trim(value)]; - return $.map(value.split(options.multipleSeparator), function(word) { - return $.trim(value).length ? $.trim(word) : null; - }); - } - - function lastWord(value) { - if ( !options.multiple ) - return value; - var words = trimWords(value); - if (words.length == 1) - return words[0]; - var cursorAt = $(input).selection().start; - if (cursorAt == value.length) { - words = trimWords(value) - } else { - words = trimWords(value.replace(value.substring(cursorAt), "")); - } - return words[words.length - 1]; - } - - // fills in the input box w/the first match (assumed to be the best match) - // q: the term entered - // sValue: the first matching result - function autoFill(q, sValue){ - // autofill in the complete box w/the first match as long as the user hasn't entered in more data - // if the last user key pressed was backspace, don't autofill - if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) { - // fill in the value (keep the case the user has typed) - $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); - // select the portion of the value not typed by the user (so the next character will erase) - $(input).selection(previousValue.length, previousValue.length + sValue.length); - } - }; - - function hideResults() { - clearTimeout(timeout); - timeout = setTimeout(hideResultsNow, 200); - }; - - function hideResultsNow() { - var wasVisible = select.visible(); - select.hide(); - clearTimeout(timeout); - stopLoading(); - if (options.mustMatch) { - // call search and run callback - $input.search( - function (result){ - // if no value found, clear the input box - if( !result ) { - if (options.multiple) { - var words = trimWords($input.val()).slice(0, -1); - $input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") ); - } - else { - $input.val( "" ); - $input.trigger("result", null); - } - } - } - ); - } - }; - - function receiveData(q, data) { - if ( data && data.length && hasFocus ) { - stopLoading(); - select.display(data, q); - autoFill(q, data[0].value); - select.show(); - } else { - hideResultsNow(); - } - }; - - function request(term, success, failure) { - if (!options.matchCase) - term = term.toLowerCase(); - var data = cache.load(term); - // recieve the cached data - if (data && data.length) { - success(term, data); - // if an AJAX url has been supplied, try loading the data now - } else if( (typeof options.url == "string") && (options.url.length > 0) ){ - - var extraParams = { - timestamp: +new Date() - }; - $.each(options.extraParams, function(key, param) { - extraParams[key] = typeof param == "function" ? param() : param; - }); - - $.ajax({ - // try to leverage ajaxQueue plugin to abort previous requests - mode: "abort", - // limit abortion to this input - port: "autocomplete" + input.name, - dataType: options.dataType, - url: options.url, - data: $.extend({ - q: lastWord(term), - limit: options.max - }, extraParams), - success: function(data) { - var parsed = options.parse && options.parse(data) || parse(data); - cache.add(term, parsed); - success(term, parsed); - } - }); - } else { - // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match - select.emptyList(); - failure(term); - } - }; - - function parse(data) { - var parsed = []; - var rows = data.split("\n"); - for (var i=0; i < rows.length; i++) { - var row = $.trim(rows[i]); - if (row) { - row = row.split("|"); - parsed[parsed.length] = { - data: row, - value: row[0], - result: options.formatResult && options.formatResult(row, row[0]) || row[0] - }; - } - } - return parsed; - }; - - function stopLoading() { - $input.removeClass(options.loadingClass); - }; - -}; - -$.Autocompleter.defaults = { - inputClass: "ac_input", - resultsClass: "ac_results", - loadingClass: "ac_loading", - minChars: 1, - delay: 400, - matchCase: false, - matchSubset: true, - matchContains: false, - cacheLength: 10, - max: 100, - mustMatch: false, - extraParams: {}, - selectFirst: true, - formatItem: function(row) { return row[0]; }, - formatMatch: null, - autoFill: false, - width: 0, - multiple: false, - multipleSeparator: ", ", - highlight: function(value, term) { - return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1"); - }, - scroll: true, - scrollHeight: 180 -}; - -$.Autocompleter.Cache = function(options) { - - var data = {}; - var length = 0; - - function matchSubset(s, sub) { - if (!options.matchCase) - s = s.toLowerCase(); - var i = s.indexOf(sub); - if (options.matchContains == "word"){ - i = s.toLowerCase().search("\\b" + sub.toLowerCase()); - } - if (i == -1) return false; - return i == 0 || options.matchContains; - }; - - function add(q, value) { - if (length > options.cacheLength){ - flush(); - } - if (!data[q]){ - length++; - } - data[q] = value; - } - - function populate(){ - if( !options.data ) return false; - // track the matches - var stMatchSets = {}, - nullData = 0; - - // no url was specified, we need to adjust the cache length to make sure it fits the local data store - if( !options.url ) options.cacheLength = 1; - - // track all options for minChars = 0 - stMatchSets[""] = []; - - // loop through the array and create a lookup structure - for ( var i = 0, ol = options.data.length; i < ol; i++ ) { - var rawValue = options.data[i]; - // if rawValue is a string, make an array otherwise just reference the array - rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; - - var value = options.formatMatch(rawValue, i+1, options.data.length); - if ( value === false ) - continue; - - var firstChar = value.charAt(0).toLowerCase(); - // if no lookup array for this character exists, look it up now - if( !stMatchSets[firstChar] ) - stMatchSets[firstChar] = []; - - // if the match is a string - var row = { - value: value, - data: rawValue, - result: options.formatResult && options.formatResult(rawValue) || value - }; - - // push the current match into the set list - stMatchSets[firstChar].push(row); - - // keep track of minChars zero items - if ( nullData++ < options.max ) { - stMatchSets[""].push(row); - } - }; - - // add the data items to the cache - $.each(stMatchSets, function(i, value) { - // increase the cache size - options.cacheLength++; - // add to the cache - add(i, value); - }); - } - - // populate any existing data - setTimeout(populate, 25); - - function flush(){ - data = {}; - length = 0; - } - - return { - flush: flush, - add: add, - populate: populate, - load: function(q) { - if (!options.cacheLength || !length) - return null; - /* - * if dealing w/local data and matchContains than we must make sure - * to loop through all the data collections looking for matches - */ - if( !options.url && options.matchContains ){ - // track all matches - var csub = []; - // loop through all the data grids for matches - for( var k in data ){ - // don't search through the stMatchSets[""] (minChars: 0) cache - // this prevents duplicates - if( k.length > 0 ){ - var c = data[k]; - $.each(c, function(i, x) { - // if we've got a match, add it to the array - if (matchSubset(x.value, q)) { - csub.push(x); - } - }); - } - } - return csub; - } else - // if the exact item exists, use it - if (data[q]){ - return data[q]; - } else - if (options.matchSubset) { - for (var i = q.length - 1; i >= options.minChars; i--) { - var c = data[q.substr(0, i)]; - if (c) { - var csub = []; - $.each(c, function(i, x) { - if (matchSubset(x.value, q)) { - csub[csub.length] = x; - } - }); - return csub; - } - } - } - return null; - } - }; -}; - -$.Autocompleter.Select = function (options, input, select, config) { - var CLASSES = { - ACTIVE: "ac_over" - }; - - var listItems, - active = -1, - data, - term = "", - needsInit = true, - element, - list; - - // Create results - function init() { - if (!needsInit) - return; - element = $("
") - .hide() - .addClass(options.resultsClass) - .css("position", "absolute") - .appendTo(document.body); - - list = $("
    ").appendTo(element).mouseover( function(event) { - if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { - active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); - $(target(event)).addClass(CLASSES.ACTIVE); - } - }).click(function(event) { - $(target(event)).addClass(CLASSES.ACTIVE); - select(); - // TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus - input.focus(); - return false; - }).mousedown(function() { - config.mouseDownOnSelect = true; - }).mouseup(function() { - config.mouseDownOnSelect = false; - }); - - if( options.width > 0 ) - element.css("width", options.width); - - needsInit = false; - } - - function target(event) { - var element = event.target; - while(element && element.tagName != "LI") - element = element.parentNode; - // more fun with IE, sometimes event.target is empty, just ignore it then - if(!element) - return []; - return element; - } - - function moveSelect(step) { - listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); - movePosition(step); - var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); - if(options.scroll) { - var offset = 0; - listItems.slice(0, active).each(function() { - offset += this.offsetHeight; - }); - if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { - list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); - } else if(offset < list.scrollTop()) { - list.scrollTop(offset); - } - } - }; - - function movePosition(step) { - active += step; - if (active < 0) { - active = listItems.size() - 1; - } else if (active >= listItems.size()) { - active = 0; - } - } - - function limitNumberOfItems(available) { - return options.max && options.max < available - ? options.max - : available; - } - - function fillList() { - list.empty(); - var max = limitNumberOfItems(data.length); - for (var i=0; i < max; i++) { - if (!data[i]) - continue; - var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term); - if ( formatted === false ) - continue; - var li = $("
  • ").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; - $.data(li, "ac_data", data[i]); - } - listItems = list.find("li"); - if ( options.selectFirst ) { - listItems.slice(0, 1).addClass(CLASSES.ACTIVE); - active = 0; - } - // apply bgiframe if available - if ( $.fn.bgiframe ) - list.bgiframe(); - } - - return { - display: function(d, q) { - init(); - data = d; - term = q; - fillList(); - }, - next: function() { - moveSelect(1); - }, - prev: function() { - moveSelect(-1); - }, - pageUp: function() { - if (active != 0 && active - 8 < 0) { - moveSelect( -active ); - } else { - moveSelect(-8); - } - }, - pageDown: function() { - if (active != listItems.size() - 1 && active + 8 > listItems.size()) { - moveSelect( listItems.size() - 1 - active ); - } else { - moveSelect(8); - } - }, - hide: function() { - element && element.hide(); - listItems && listItems.removeClass(CLASSES.ACTIVE); - active = -1; - }, - visible : function() { - return element && element.is(":visible"); - }, - current: function() { - return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); - }, - show: function() { - var offset = $(input).offset(); - element.css({ - width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).innerWidth(), - top: offset.top + input.offsetHeight, - left: offset.left - }).show(); - options.show(element); - if(options.scroll) { - list.scrollTop(0); - list.css({ - maxHeight: options.scrollHeight, - overflow: 'auto' - }); - - if($.browser.msie && typeof document.body.style.maxHeight === "undefined") { - var listHeight = 0; - listItems.each(function() { - listHeight += this.offsetHeight; - }); - var scrollbarsVisible = listHeight > options.scrollHeight; - list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight ); - if (!scrollbarsVisible) { - // IE doesn't recalculate width when scrollbar disappears - listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) ); - } - } - - } - }, - selected: function() { - var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); - return selected && selected.length && $.data(selected[0], "ac_data"); - }, - emptyList: function (){ - list && list.empty(); - }, - unbind: function() { - element && element.remove(); - } - }; -}; - -$.fn.selection = function(start, end) { - if (start !== undefined) { - return this.each(function() { - if( this.createTextRange ){ - var selRange = this.createTextRange(); - if (end === undefined || start == end) { - selRange.move("character", start); - selRange.select(); - } else { - selRange.collapse(true); - selRange.moveStart("character", start); - selRange.moveEnd("character", end); - selRange.select(); - } - } else if( this.setSelectionRange ){ - this.setSelectionRange(start, end); - } else if( this.selectionStart ){ - this.selectionStart = start; - this.selectionEnd = end; - } - }); - } - var field = this[0]; - if ( field.createTextRange ) { - var range = document.selection.createRange(), - orig = field.value, - teststring = "<->", - textLength = range.text.length; - range.text = teststring; - var caretAt = field.value.indexOf(teststring); - field.value = orig; - this.selection(caretAt, caretAt + textLength); - return { - start: caretAt, - end: caretAt + textLength - } - } else if( field.selectionStart !== undefined ){ - return { - start: field.selectionStart, - end: field.selectionEnd - } - } -}; - -})(jQuery); -/** - * jQuery.fn.sortElements - * -------------- - * @author James Padolsey (http://james.padolsey.com) - * @version 0.11 - * @updated 18-MAR-2010 - * -------------- - * @param Function comparator: - * Exactly the same behaviour as [1,2,3].sort(comparator) - * - * @param Function getSortable - * A function that should return the element that is - * to be sorted. The comparator will run on the - * current collection, but you may want the actual - * resulting sort to occur on a parent or another - * associated element. - * - * E.g. $('td').sortElements(comparator, function(){ - * return this.parentNode; - * }) - * - * The
) will be sorted instead - * of the
's parent (
itself. - */ -jQuery.fn.sortElements = (function(){ - - var sort = [].sort; - - return function(comparator, getSortable) { - - getSortable = getSortable || function(){return this;}; - - var placements = this.map(function(){ - - var sortElement = getSortable.call(this), - parentNode = sortElement.parentNode, - - // Since the element itself will change position, we have - // to have some way of storing it's original position in - // the DOM. The easiest way is to have a 'flag' node: - nextSibling = parentNode.insertBefore( - document.createTextNode(''), - sortElement.nextSibling - ); - - return function() { - - if (parentNode === this) { - throw new Error( - "You can't sort elements if any one is a descendant of another." - ); - } - - // Insert before flag: - parentNode.insertBefore(this, nextSibling); - // Remove flag: - parentNode.removeChild(nextSibling); - - }; - - }); - - return sort.call(this, comparator).each(function(i){ - placements[i].call(getSortable.call(this)); - }); - - }; - -})(); -/*! - * ApiGen 2.8.0 - API documentation generator for PHP 5.3+ - * - * Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com) - * Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich) - * Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville) - * - * For the full copyright and license information, please view - * the file LICENSE.md that was distributed with this source code. - */ - -$(function() { - var $document = $(document); - var $left = $('#left'); - var $right = $('#right'); - var $rightInner = $('#rightInner'); - var $splitter = $('#splitter'); - var $groups = $('#groups'); - var $content = $('#content'); - - // Menu - - // Hide deep packages and namespaces - $('ul span', $groups).click(function(event) { - event.preventDefault(); - event.stopPropagation(); - $(this) - .toggleClass('collapsed') - .parent() - .next('ul') - .toggleClass('collapsed'); - }).click(); - - $active = $('ul li.active', $groups); - if ($active.length > 0) { - // Open active - $('> a > span', $active).click(); - } else { - $main = $('> ul > li.main', $groups); - if ($main.length > 0) { - // Open first level of the main project - $('> a > span', $main).click(); - } else { - // Open first level of all - $('> ul > li > a > span', $groups).click(); - } - } - - // Content - - // Search autocompletion - var autocompleteFound = false; - var autocompleteFiles = {'c': 'class', 'co': 'constant', 'f': 'function', 'm': 'class', 'mm': 'class', 'p': 'class', 'mp': 'class', 'cc': 'class'}; - var $search = $('#search input[name=q]'); - $search - .autocomplete(ApiGen.elements, { - matchContains: true, - scrollHeight: 200, - max: 20, - formatItem: function(data) { - return data[1].replace(/^(.+\\)(.+)$/, '$1$2'); - }, - formatMatch: function(data) { - return data[1]; - }, - formatResult: function(data) { - return data[1]; - }, - show: function($list) { - var $items = $('li span', $list); - var maxWidth = Math.max.apply(null, $items.map(function() { - return $(this).width(); - })); - // 10px padding - $list - .width(Math.max(maxWidth + 10, $search.innerWidth())) - .css('left', $search.offset().left + $search.outerWidth() - $list.outerWidth()); - } - }).result(function(event, data) { - autocompleteFound = true; - var location = window.location.href.split('/'); - location.pop(); - var parts = data[1].split(/::|$/); - var file = $.sprintf(ApiGen.config.templates.main[autocompleteFiles[data[0]]].filename, parts[0].replace(/[^\w]/g, '.')); - if (parts[1]) { - file += '#' + ('mm' === data[0] || 'mp' === data[0] ? 'm' : '') + parts[1].replace(/([\w]+)\(\)/, '_$1'); - } - location.push(file); - window.location = location.join('/'); - - // Workaround for Opera bug - $(this).closest('form').attr('action', location.join('/')); - }).closest('form') - .submit(function() { - var query = $search.val(); - if ('' === query) { - return false; - } - - var label = $('#search input[name=more]').val(); - if (!autocompleteFound && label && -1 === query.indexOf('more:')) { - $search.val(query + ' more:' + label); - } - - return !autocompleteFound && '' !== $('#search input[name=cx]').val(); - }); - - // Save natural order - $('table.summary tr[data-order]', $content).each(function(index) { - do { - index = '0' + index; - } while (index.length < 3); - $(this).attr('data-order-natural', index); - }); - - // Switch between natural and alphabetical order - var $caption = $('table.summary', $content) - .filter(':has(tr[data-order])') - .find('caption'); - $caption - .click(function() { - var $this = $(this); - var order = $this.data('order') || 'natural'; - order = 'natural' === order ? 'alphabetical' : 'natural'; - $this.data('order', order); - $.cookie('order', order, {expires: 365}); - var attr = 'alphabetical' === order ? 'data-order' : 'data-order-natural'; - $this - .closest('table') - .find('tr').sortElements(function(a, b) { - return $(a).attr(attr) > $(b).attr(attr) ? 1 : -1; - }); - return false; - }) - .addClass('switchable') - .attr('title', 'Switch between natural and alphabetical order'); - if ((null === $.cookie('order') && 'alphabetical' === ApiGen.config.options.elementsOrder) || 'alphabetical' === $.cookie('order')) { - $caption.click(); - } - - // Open details - if (ApiGen.config.options.elementDetailsCollapsed) { - $('tr', $content).filter(':has(.detailed)') - .click(function() { - var $this = $(this); - $('.short', $this).hide(); - $('.detailed', $this).show(); - }); - } - - // Splitter - var splitterWidth = $splitter.width(); - function setSplitterPosition(position) - { - $left.width(position); - $right.css('margin-left', position + splitterWidth); - $splitter.css('left', position); - } - function setNavigationPosition() - { - var width = $rightInner.width(); - $rightInner - .toggleClass('medium', width <= 960) - .toggleClass('small', width <= 650); - } - $splitter.mousedown(function() { - $splitter.addClass('active'); - - $document.mousemove(function(event) { - if (event.pageX >= 230 && $document.width() - event.pageX >= 600 + splitterWidth) { - setSplitterPosition(event.pageX); - setNavigationPosition(); - } - }); - - $() - .add($splitter) - .add($document) - .mouseup(function() { - $splitter - .removeClass('active') - .unbind('mouseup'); - $document - .unbind('mousemove') - .unbind('mouseup'); - - $.cookie('splitter', parseInt($splitter.css('left')), {expires: 365}); - }); - - return false; - }); - var splitterPosition = $.cookie('splitter'); - if (null !== splitterPosition) { - setSplitterPosition(parseInt(splitterPosition)); - } - setNavigationPosition(); - $(window).resize(setNavigationPosition); - - // Select selected lines - var matches = window.location.hash.substr(1).match(/^\d+(?:-\d+)?(?:,\d+(?:-\d+)?)*$/); - if (null !== matches) { - var lists = matches[0].split(','); - for (var i = 0; i < lists.length; i++) { - var lines = lists[i].split('-'); - lines[1] = lines[1] || lines[0]; - for (var j = lines[0]; j <= lines[1]; j++) { - $('#' + j).addClass('selected'); - } - } - - var $firstLine = $('#' + parseInt(matches[0])); - if ($firstLine.length > 0) { - $right.scrollTop($firstLine.offset().top); - } - } - - // Save selected lines - var lastLine; - $('a.l').click(function(event) { - event.preventDefault(); - - var $selectedLine = $(this).parent(); - var selectedLine = parseInt($selectedLine.attr('id')); - - if (event.shiftKey) { - if (lastLine) { - for (var i = Math.min(selectedLine, lastLine); i <= Math.max(selectedLine, lastLine); i++) { - $('#' + i).addClass('selected'); - } - } else { - $selectedLine.addClass('selected'); - } - } else if (event.ctrlKey) { - $selectedLine.toggleClass('selected'); - } else { - var $selected = $('.l.selected') - .not($selectedLine) - .removeClass('selected'); - if ($selected.length > 0) { - $selectedLine.addClass('selected'); - } else { - $selectedLine.toggleClass('selected'); - } - } - - lastLine = $selectedLine.hasClass('selected') ? selectedLine : null; - - // Update hash - var lines = $('.l.selected') - .map(function() { - return parseInt($(this).attr('id')); - }) - .get() - .sort(function(a, b) { - return a - b; - }); - - var hash = []; - var list = []; - for (var j = 0; j < lines.length; j++) { - if (0 === j && j + 1 === lines.length) { - hash.push(lines[j]); - } else if (0 === j) { - list[0] = lines[j]; - } else if (lines[j - 1] + 1 !== lines[j] && j + 1 === lines.length) { - hash.push(list.join('-')); - hash.push(lines[j]); - } else if (lines[j - 1] + 1 !== lines[j]) { - hash.push(list.join('-')); - list = [lines[j]]; - } else if (j + 1 === lines.length) { - list[1] = lines[j]; - hash.push(list.join('-')); - } else { - list[1] = lines[j]; - } - } - - window.location.hash = hash.join(','); - }); -}); - diff --git a/docs/resources/footer.png b/docs/resources/footer.png deleted file mode 100644 index 51f4a7f..0000000 Binary files a/docs/resources/footer.png and /dev/null differ diff --git a/docs/resources/inherit.png b/docs/resources/inherit.png deleted file mode 100644 index 957079b..0000000 Binary files a/docs/resources/inherit.png and /dev/null differ diff --git a/docs/resources/resize.png b/docs/resources/resize.png deleted file mode 100644 index fb98a7a..0000000 Binary files a/docs/resources/resize.png and /dev/null differ diff --git a/docs/resources/sort.png b/docs/resources/sort.png deleted file mode 100644 index 0d0fea1..0000000 Binary files a/docs/resources/sort.png and /dev/null differ diff --git a/docs/resources/style.css b/docs/resources/style.css deleted file mode 100644 index f361474..0000000 --- a/docs/resources/style.css +++ /dev/null @@ -1,608 +0,0 @@ -/*! - * ApiGen 2.8.0 - API documentation generator for PHP 5.3+ - * - * Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com) - * Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich) - * Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville) - * - * For the full copyright and license information, please view - * the file LICENSE.md that was distributed with this source code. - */ - -body { - font: 13px/1.5 Verdana, 'Geneva CE', lucida, sans-serif; - margin: 0; - padding: 0; - background: #ffffff; - color: #333333; -} - -h1, h2, h3, h4, caption { - font-family: 'Trebuchet MS', 'Geneva CE', lucida, sans-serif; - color: #053368; -} - -h1 { - color: #1e5eb6; - font-size: 230%; - font-weight: normal; - margin: .3em 0; -} - -h2 { - color: #1e5eb6; - font-size: 150%; - font-weight: normal; - margin: -.3em 0 .3em 0; -} - -h3 { - font-size: 1.6em; - font-weight: normal; - margin-bottom: 2px; -} - -h4 { - font-size: 100%; - font-weight: bold; - padding: 0; - margin: 0; -} - -caption { - border: 1px solid #cccccc; - background: #ecede5; - font-weight: bold; - font-size: 1.2em; - padding: 3px 5px; - text-align: left; - margin-bottom: 0; -} - -p { - margin: .7em 0 1em; - padding: 0; -} - -hr { - margin: 2em 0 1em; - border: none; - border-top: 1px solid #cccccc; - height: 0; -} - -a { - color: #006aeb; - padding: 3px 1px; - text-decoration: none; -} - -h1 a { - color: #1e5eb6; -} - -a:hover, a:active, a:focus, a:hover b, a:hover var { - background-color: #006aeb; - color: #ffffff !important; -} - -code, var, pre { - font-family: monospace; -} - -var { - font-weight: bold; - font-style: normal; - color: #ca8a04; -} - -pre { - margin: 0; -} - -code a b { - color: #000000; -} - -.deprecated { - text-decoration: line-through; -} - -.invalid { - color: #e71818; -} - -.hidden { - display: none; -} - -/* Left side */ -#left { - overflow: auto; - width: 270px; - height: 100%; - position: fixed; -} - -/* Menu */ -#menu { - padding: 10px; -} - -#menu ul { - list-style: none; - padding: 0; - margin: 0; -} - -#menu ul ul { - padding-left: 10px; -} - -#menu li { - white-space: nowrap; - position: relative; -} - -#menu a { - display: block; - padding: 0 2px; -} - -#menu .active > a, #menu > span { - color: #333333; - background: none; - font-weight: bold; -} - -#menu .active > a.invalid { - color: #e71818; -} - -#menu .active > a:hover, #menu .active > a:active, #menu .active > a:focus { - background-color: #006aeb; -} - -#menu #groups span { - position: absolute; - top: 4px; - right: 2px; - cursor: pointer; - display: block; - width: 12px; - height: 12px; - background: url('collapsed.png') transparent 0 0 no-repeat; -} - -#menu #groups span:hover { - background-position: -12px 0; -} - -#menu #groups span.collapsed { - background-position: 0 -12px; -} - -#menu #groups span.collapsed:hover { - background-position: -12px -12px; -} - -#menu #groups ul.collapsed { - display: none; -} - -/* Right side */ -#right { - overflow: auto; - margin-left: 275px; - height: 100%; - position: fixed; - left: 0; - right: 0; -} - -#rightInner { - max-width: 1000px; - min-width: 350px; -} - -/* Search */ -#search { - float: right; - margin: 3px 8px; -} - -#search input.text { - padding: 3px 5px; - width: 250px; -} - -/* Autocomplete */ -.ac_results { - padding: 0; - border: 1px solid #cccccc; - background-color: #ffffff; - overflow: hidden; - z-index: 99999; -} - -.ac_results ul { - width: 100%; - list-style-position: outside; - list-style: none; - padding: 0; - margin: 0; -} - -.ac_results li { - margin: 0; - padding: 2px 5px; - cursor: default; - display: block; - font: 12px 'Trebuchet MS', 'Geneva CE', lucida, sans-serif; - line-height: 16px; - overflow: hidden; - white-space: nowrap; -} - -.ac_results li strong { - color: #000000; -} - -.ac_odd { - background-color: #eeeeee; -} - -.ac_over { - background-color: #006aeb; - color: #ffffff; -} - -.ac_results li.ac_over strong { - color: #ffffff; -} - -/* Navigation */ -#navigation { - padding: 3px 8px; - background-color: #f6f6f4; - height: 26px; -} - -#navigation ul { - list-style: none; - margin: 0 8px 4px 0; - padding: 0; - overflow: hidden; - float: left; -} - -#navigation ul + ul { - border-left: 1px solid #000000; - padding-left: 8px; -} - -#navigation ul li { - float: left; - margin: 2px; - padding: 0 3px; - font-family: Verdana, 'Geneva CE', lucida, sans-serif; - color: #808080; -} - -#navigation ul li.active { - background-color: #053368; - color: #ffffff; - font-weight: bold; -} - -#navigation ul li a { - color: #000000; - font-weight: bold; - padding: 0; -} - -#navigation ul li span { - float: left; - padding: 0 3px; -} - -#navigation ul li a:hover span, #navigation ul li a:active span, #navigation ul li a:focus span { - background-color: #006aeb; -} - -/* Content */ -#content { - clear: both; - padding: 5px 15px; -} - -.description pre { - padding: .6em; - background: #fcfcf7; -} - -#content > .description { - background: #ecede5; - padding: 1px 8px; - margin: 1.2em 0; -} - -#content > .description pre { - margin: .5em 0; -} - -dl.tree { - margin: 1.2em 0; -} - -dl.tree dd { - margin: 0; - padding: 0; -} - -.info { - margin: 1.2em 0; -} - -.summary { - border: 1px solid #cccccc; - border-collapse: collapse; - font-size: 1em; - width: 100%; - margin: 1.2em 0 2.4em; -} - -.summary caption { - border-width: 1px 1px 0; -} - -.summary caption.switchable { - background: #ecede5 url('sort.png') no-repeat center right; - cursor: pointer; -} - -.summary td { - border: 1px solid #cccccc; - margin: 0; - padding: 3px 10px; - font-size: 1em; - vertical-align: top; -} - -.summary td:first-child { - text-align: right; -} - -#packages.summary td:first-child, #namespaces.summary td:first-child, .inherited.summary td:first-child, .used.summary td:first-child { - text-align: left; -} - -.summary tr:hover td { - background: #f6f6f4; -} - -.summary .description pre { - border: .5em solid #ecede5; -} - -.summary .description p { - margin: 0; -} - -.summary .description p + p, .summary .description ul { - margin: 3px 0 0 0; -} - -.summary .description.detailed h4 { - margin-top: 3px; -} - -.summary dl { - margin: 0; -} - -.summary dd { - margin: 0 0 0 25px; -} - -.name, .attributes { - white-space: nowrap; -} - -.value { - white-space: pre-wrap; -} - -td.name, td.attributes { - width: 1%; -} - -.class #methods .name { - width: auto; - white-space: normal; -} - -.class #methods .name > div > code { - white-space: pre-wrap; -} - -.class #methods .name > div > code span, .function .value > code { - white-space: nowrap; -} - -.class #methods td.name > div, .class td.description > div { - position: relative; - padding-right: 1em; -} - -.anchor { - position: absolute; - top: 0; - right: 0; - line-height: 1; - font-size: 85%; - margin: 0; - color: #006aeb !important; -} - -.list { - margin: 0 0 5px 25px; -} - -div.invalid { - background-color: #fae4e0; - padding: 10px; -} - -/* Splitter */ -#splitter { - position: fixed; - height: 100%; - width: 5px; - left: 270px; - background: #1e5eb6 url('resize.png') left center no-repeat; - cursor: e-resize; -} - -#splitter.active { - opacity: .5; -} - -/* Footer */ -#footer { - border-top: 1px solid #e9eeef; - clear: both; - color: #a7a7a7; - font-size: 8pt; - text-align: center; - padding: 20px 0 0; - margin: 3em 0 0; - height: 90px; - background: #ffffff url('footer.png') no-repeat center top; -} - -/* Tree */ -div.tree ul { - list-style: none; - background: url('tree-vertical.png') left repeat-y; - padding: 0; - margin-left: 20px; -} - -div.tree li { - margin: 0; - padding: 0; -} - -div.tree div { - padding-left: 30px; -} - -div.tree div.notlast { - background: url('tree-hasnext.png') left 10px no-repeat; -} - -div.tree div.last { - background: url('tree-last.png') left -240px no-repeat; -} - -div.tree li.last { - background: url('tree-cleaner.png') left center repeat-y; -} - -div.tree span.padding { - padding-left: 15px; -} - -/* Source code */ -.php-keyword1 { - color: #e71818; - font-weight: bold; -} - -.php-keyword2 { - font-weight: bold; -} - -.php-var { - color: #d59401; - font-weight: bold; -} - -.php-num { - color: #cd0673; -} - -.php-quote { - color: #008000; -} - -.php-comment { - color: #929292; -} - -.xlang { - color: #ff0000; - font-weight: bold; -} - -span.l { - display: block; -} - -span.l.selected { - background: #f6f6f4; -} - -span.l a { - color: #333333; -} - -span.l a:hover, div.l a:active, div.l a:focus { - background: transparent; - color: #333333 !important; -} - -span.l .php-var a { - color: #d59401; -} - -span.l .php-var a:hover, span.l .php-var a:active, span.l .php-var a:focus { - color: #d59401 !important; -} - -span.l a.l { - padding-left: 2px; - color: #c0c0c0; -} - -span.l a.l:hover, span.l a.l:active, span.l a.l:focus { - background: transparent; - color: #c0c0c0 !important; -} - -#rightInner.medium #navigation { - height: 52px; -} - -#rightInner.medium #navigation ul:first-child + ul { - clear: left; - border: none; - padding: 0; -} - -#rightInner.medium .name, #rightInner.medium .attributes { - white-space: normal; -} - -#rightInner.small #search { - float: left; -} - -#rightInner.small #navigation { - height: 78px; -} - -#rightInner.small #navigation ul:first-child { - clear: both; -} diff --git a/docs/resources/tree-cleaner.png b/docs/resources/tree-cleaner.png deleted file mode 100644 index 2eb9085..0000000 Binary files a/docs/resources/tree-cleaner.png and /dev/null differ diff --git a/docs/resources/tree-hasnext.png b/docs/resources/tree-hasnext.png deleted file mode 100644 index 91d6b79..0000000 Binary files a/docs/resources/tree-hasnext.png and /dev/null differ diff --git a/docs/resources/tree-last.png b/docs/resources/tree-last.png deleted file mode 100644 index 7f319f8..0000000 Binary files a/docs/resources/tree-last.png and /dev/null differ diff --git a/docs/resources/tree-vertical.png b/docs/resources/tree-vertical.png deleted file mode 100644 index 384908b..0000000 Binary files a/docs/resources/tree-vertical.png and /dev/null differ diff --git a/docs/source-class-Ctct.Auth.CtctDataStore.html b/docs/source-class-Ctct.Auth.CtctDataStore.html deleted file mode 100644 index cdd8938..0000000 --- a/docs/source-class-Ctct.Auth.CtctDataStore.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - File Ctct/Auth/CtctDataStore.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Auth.CtctOAuth2.html b/docs/source-class-Ctct.Auth.CtctOAuth2.html deleted file mode 100644 index 5a420e2..0000000 --- a/docs/source-class-Ctct.Auth.CtctOAuth2.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - File Auth/CtctOAuth2.php - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Auth.SessionDataStore.html b/docs/source-class-Ctct.Auth.SessionDataStore.html deleted file mode 100644 index 78c9774..0000000 --- a/docs/source-class-Ctct.Auth.SessionDataStore.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - File Ctct/Auth/SessionDataStore.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Account.VerifiedEmailAddress.html b/docs/source-class-Ctct.Components.Account.VerifiedEmailAddress.html deleted file mode 100644 index 4128e13..0000000 --- a/docs/source-class-Ctct.Components.Account.VerifiedEmailAddress.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - File Ctct/Components/Account/VerifiedEmailAddress.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Activities.Activity.html b/docs/source-class-Ctct.Components.Activities.Activity.html deleted file mode 100644 index 7ac2fb2..0000000 --- a/docs/source-class-Ctct.Components.Activities.Activity.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - File Ctct/Components/Activities/Activity.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Activities.ActivityError.html b/docs/source-class-Ctct.Components.Activities.ActivityError.html deleted file mode 100644 index 30e4afd..0000000 --- a/docs/source-class-Ctct.Components.Activities.ActivityError.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - File Ctct/Components/Activities/ActivityError.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Activities.AddContacts.html b/docs/source-class-Ctct.Components.Activities.AddContacts.html deleted file mode 100644 index 6d7f7af..0000000 --- a/docs/source-class-Ctct.Components.Activities.AddContacts.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - File Ctct/Components/Activities/AddContacts.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Activities.AddContactsImportData.html b/docs/source-class-Ctct.Components.Activities.AddContactsImportData.html deleted file mode 100644 index 8a5e41c..0000000 --- a/docs/source-class-Ctct.Components.Activities.AddContactsImportData.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - File Ctct/Components/Activities/AddContactsImportData.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Activities.ExportContacts.html b/docs/source-class-Ctct.Components.Activities.ExportContacts.html deleted file mode 100644 index 89edfb9..0000000 --- a/docs/source-class-Ctct.Components.Activities.ExportContacts.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - File Ctct/Components/Activities/ExportContacts.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Component.html b/docs/source-class-Ctct.Components.Component.html deleted file mode 100644 index aef67fa..0000000 --- a/docs/source-class-Ctct.Components.Component.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - File Ctct/Components/Component.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Contacts.Address.html b/docs/source-class-Ctct.Components.Contacts.Address.html deleted file mode 100644 index 72a5d02..0000000 --- a/docs/source-class-Ctct.Components.Contacts.Address.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - File Ctct/Components/Contacts/Address.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Contacts.Contact.html b/docs/source-class-Ctct.Components.Contacts.Contact.html deleted file mode 100644 index 081f6b5..0000000 --- a/docs/source-class-Ctct.Components.Contacts.Contact.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - File Ctct/Components/Contacts/Contact.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Contacts.ContactList.html b/docs/source-class-Ctct.Components.Contacts.ContactList.html deleted file mode 100644 index 0d0f072..0000000 --- a/docs/source-class-Ctct.Components.Contacts.ContactList.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - File Ctct/Components/Contacts/ContactList.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Contacts.CustomField.html b/docs/source-class-Ctct.Components.Contacts.CustomField.html deleted file mode 100644 index 2bf08f4..0000000 --- a/docs/source-class-Ctct.Components.Contacts.CustomField.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - File Ctct/Components/Contacts/CustomField.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Contacts.EmailAddress.html b/docs/source-class-Ctct.Components.Contacts.EmailAddress.html deleted file mode 100644 index 734e023..0000000 --- a/docs/source-class-Ctct.Components.Contacts.EmailAddress.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - File Ctct/Components/Contacts/EmailAddress.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Contacts.Note.html b/docs/source-class-Ctct.Components.Contacts.Note.html deleted file mode 100644 index f81bb54..0000000 --- a/docs/source-class-Ctct.Components.Contacts.Note.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - File Ctct/Components/Contacts/Note.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.EmailMarketing.Campaign.html b/docs/source-class-Ctct.Components.EmailMarketing.Campaign.html deleted file mode 100644 index ad26210..0000000 --- a/docs/source-class-Ctct.Components.EmailMarketing.Campaign.html +++ /dev/null @@ -1,424 +0,0 @@ - - - - - - - - File Ctct/Components/EmailMarketing/Campaign.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.EmailMarketing.ClickThroughDetails.html b/docs/source-class-Ctct.Components.EmailMarketing.ClickThroughDetails.html deleted file mode 100644 index bd42097..0000000 --- a/docs/source-class-Ctct.Components.EmailMarketing.ClickThroughDetails.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - File Ctct/Components/EmailMarketing/ClickThroughDetails.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.EmailMarketing.MessageFooter.html b/docs/source-class-Ctct.Components.EmailMarketing.MessageFooter.html deleted file mode 100644 index e16cbd2..0000000 --- a/docs/source-class-Ctct.Components.EmailMarketing.MessageFooter.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - File Ctct/Components/EmailMarketing/MessageFooter.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.EmailMarketing.Schedule.html b/docs/source-class-Ctct.Components.EmailMarketing.Schedule.html deleted file mode 100644 index c947c0c..0000000 --- a/docs/source-class-Ctct.Components.EmailMarketing.Schedule.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - File Ctct/Components/EmailMarketing/Schedule.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.EmailMarketing.TestSend.html b/docs/source-class-Ctct.Components.EmailMarketing.TestSend.html deleted file mode 100644 index f8f96aa..0000000 --- a/docs/source-class-Ctct.Components.EmailMarketing.TestSend.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - - - File Components/EmailMarketing/TestSend.php - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.ResultSet.html b/docs/source-class-Ctct.Components.ResultSet.html deleted file mode 100644 index 59c411b..0000000 --- a/docs/source-class-Ctct.Components.ResultSet.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - File Ctct/Components/ResultSet.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Tracking.BounceActivity.html b/docs/source-class-Ctct.Components.Tracking.BounceActivity.html deleted file mode 100644 index d6b019f..0000000 --- a/docs/source-class-Ctct.Components.Tracking.BounceActivity.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - File Ctct/Components/Tracking/BounceActivity.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Tracking.ClickActivity.html b/docs/source-class-Ctct.Components.Tracking.ClickActivity.html deleted file mode 100644 index 1859eb8..0000000 --- a/docs/source-class-Ctct.Components.Tracking.ClickActivity.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - File Ctct/Components/Tracking/ClickActivity.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Tracking.ForwardActivity.html b/docs/source-class-Ctct.Components.Tracking.ForwardActivity.html deleted file mode 100644 index be0a76c..0000000 --- a/docs/source-class-Ctct.Components.Tracking.ForwardActivity.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - File Ctct/Components/Tracking/ForwardActivity.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Tracking.OpenActivity.html b/docs/source-class-Ctct.Components.Tracking.OpenActivity.html deleted file mode 100644 index 62ce910..0000000 --- a/docs/source-class-Ctct.Components.Tracking.OpenActivity.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - File Ctct/Components/Tracking/OpenActivity.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Tracking.OptOutActivity.html b/docs/source-class-Ctct.Components.Tracking.OptOutActivity.html deleted file mode 100644 index 71cce8b..0000000 --- a/docs/source-class-Ctct.Components.Tracking.OptOutActivity.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - File Ctct/Components/Tracking/OptOutActivity.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Tracking.SendActivity.html b/docs/source-class-Ctct.Components.Tracking.SendActivity.html deleted file mode 100644 index d23b878..0000000 --- a/docs/source-class-Ctct.Components.Tracking.SendActivity.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - File Ctct/Components/Tracking/SendActivity.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Tracking.TrackingActivity.html b/docs/source-class-Ctct.Components.Tracking.TrackingActivity.html deleted file mode 100644 index c148531..0000000 --- a/docs/source-class-Ctct.Components.Tracking.TrackingActivity.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - File Ctct/Components/Tracking/TrackingActivity.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Components.Tracking.TrackingSummary.html b/docs/source-class-Ctct.Components.Tracking.TrackingSummary.html deleted file mode 100644 index 6b8ac55..0000000 --- a/docs/source-class-Ctct.Components.Tracking.TrackingSummary.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - File Ctct/Components/Tracking/TrackingSummary.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.ConstantContact.html b/docs/source-class-Ctct.ConstantContact.html deleted file mode 100644 index 808d9ec..0000000 --- a/docs/source-class-Ctct.ConstantContact.html +++ /dev/null @@ -1,855 +0,0 @@ - - - - - - - - File Ctct/ConstantContact.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Exceptions.CtctException.html b/docs/source-class-Ctct.Exceptions.CtctException.html deleted file mode 100644 index 393b902..0000000 --- a/docs/source-class-Ctct.Exceptions.CtctException.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - File Ctct/Exceptions/CtctException.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Exceptions.IllegalArgumentException.html b/docs/source-class-Ctct.Exceptions.IllegalArgumentException.html deleted file mode 100644 index 1531673..0000000 --- a/docs/source-class-Ctct.Exceptions.IllegalArgumentException.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - File Ctct/Exceptions/IllegalArgumentException.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Exceptions.OAuth2Exception.html b/docs/source-class-Ctct.Exceptions.OAuth2Exception.html deleted file mode 100644 index a56801a..0000000 --- a/docs/source-class-Ctct.Exceptions.OAuth2Exception.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - File Ctct/Exceptions/OAuth2Exception.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/source-class-Ctct.Services.AccountService.html b/docs/source-class-Ctct.Services.AccountService.html deleted file mode 100644 index 583f92a..0000000 --- a/docs/source-class-Ctct.Services.AccountService.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - File Ctct/Services/AccountService.php | Appconnect PHP SDK - - - - - - - - - - -
- - - - diff --git a/docs/source-class-Ctct.Services.ActivityService.html b/docs/source-class-Ctct.Services.ActivityService.html deleted file mode 100644 index 724e156..0000000 --- a/docs/source-class-Ctct.Services.ActivityService.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - File Ctct/Services/ActivityService.php | Appconnect PHP SDK - - - - - - - - - - -
- - - - diff --git a/docs/source-class-Ctct.Services.BaseService.html b/docs/source-class-Ctct.Services.BaseService.html deleted file mode 100644 index ec2f61a..0000000 --- a/docs/source-class-Ctct.Services.BaseService.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - File Ctct/Services/BaseService.php | Appconnect PHP SDK - - - - - - - - - - -
- - - - diff --git a/docs/source-class-Ctct.Services.CampaignScheduleService.html b/docs/source-class-Ctct.Services.CampaignScheduleService.html deleted file mode 100644 index 32a6209..0000000 --- a/docs/source-class-Ctct.Services.CampaignScheduleService.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - File Ctct/Services/CampaignScheduleService.php | Appconnect PHP SDK - - - - - - - - - - -
- - - - diff --git a/docs/source-class-Ctct.Services.CampaignTrackingService.html b/docs/source-class-Ctct.Services.CampaignTrackingService.html deleted file mode 100644 index 990dab0..0000000 --- a/docs/source-class-Ctct.Services.CampaignTrackingService.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - File Ctct/Services/CampaignTrackingService.php | Appconnect PHP SDK - - - - - - - - - - -
- - - - diff --git a/docs/source-class-Ctct.Services.ContactService.html b/docs/source-class-Ctct.Services.ContactService.html deleted file mode 100644 index e73f2b9..0000000 --- a/docs/source-class-Ctct.Services.ContactService.html +++ /dev/null @@ -1,252 +0,0 @@ - - - - - - - - File Ctct/Services/ContactService.php | Appconnect PHP SDK - - - - - - - - - - -
- - - - diff --git a/docs/source-class-Ctct.Services.ContactTrackingService.html b/docs/source-class-Ctct.Services.ContactTrackingService.html deleted file mode 100644 index 5e52d8c..0000000 --- a/docs/source-class-Ctct.Services.ContactTrackingService.html +++ /dev/null @@ -1,302 +0,0 @@ - - - - - - - - File Ctct/Services/ContactTrackingService.php | Appconnect PHP SDK - - - - - - - - - - -
- - - - diff --git a/docs/source-class-Ctct.Services.EmailMarketingService.html b/docs/source-class-Ctct.Services.EmailMarketingService.html deleted file mode 100644 index 14079cf..0000000 --- a/docs/source-class-Ctct.Services.EmailMarketingService.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - File Ctct/Services/EmailMarketingService.php | Appconnect PHP SDK - - - - - - - - - - -
- - - - diff --git a/docs/source-class-Ctct.Services.ListService.html b/docs/source-class-Ctct.Services.ListService.html deleted file mode 100644 index 7474c55..0000000 --- a/docs/source-class-Ctct.Services.ListService.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - - File Ctct/Services/ListService.php | Appconnect PHP SDK - - - - - - - - - - -
- - - - diff --git a/docs/source-class-Ctct.SplClassLoader.html b/docs/source-class-Ctct.SplClassLoader.html deleted file mode 100644 index 156f8bd..0000000 --- a/docs/source-class-Ctct.SplClassLoader.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - - - File Ctct/SplClassLoader.php | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/docs/tree.html b/docs/tree.html deleted file mode 100644 index 56f0c6b..0000000 --- a/docs/tree.html +++ /dev/null @@ -1,496 +0,0 @@ - - - - - - - Tree | Appconnect PHP SDK - - - - - - - - -
- -
- -
- - - - diff --git a/examples/addOrUpdateContact.php b/examples/addOrUpdateContact.php index 9862c4c..c74a103 100644 --- a/examples/addOrUpdateContact.php +++ b/examples/addOrUpdateContact.php @@ -4,9 +4,17 @@ Constant Contact API v2 Add/Update Contact Example - + + + getLists(ACCESS_TOKEN); } catch (CtctException $ex) { foreach ($ex->getErrors() as $error) { print_r($error); - } + } } // check if the form was submitted @@ -45,79 +54,100 @@ $contact->addList($_POST['list']); $contact->first_name = $_POST['first_name']; $contact->last_name = $_POST['last_name']; - $returnContact = $cc->addContact(ACCESS_TOKEN, $contact); - // update the existing contact if address already existed - } else { + /* + * The third parameter of addContact defaults to false, but if this were set to true it would tell Constant + * Contact that this action is being performed by the contact themselves, and gives the ability to + * opt contacts back in and trigger Welcome/Change-of-interest emails. + * + * See: http://developer.constantcontact.com/docs/contacts-api/contacts-index.html#opt_in + */ + $returnContact = $cc->addContact(ACCESS_TOKEN, $contact, false); + + // update the existing contact if address already existed + } else { $action = "Updating Contact"; $contact = $response->results[0]; $contact->addList($_POST['list']); $contact->first_name = $_POST['first_name']; $contact->last_name = $_POST['last_name']; - $returnContact = $cc->updateContact(ACCESS_TOKEN, $contact); + + /* + * The third parameter of updateContact defaults to false, but if this were set to true it would tell + * Constant Contact that this action is being performed by the contact themselves, and gives the ability to + * opt contacts back in and trigger Welcome/Change-of-interest emails. + * + * See: http://developer.constantcontact.com/docs/contacts-api/contacts-index.html#opt_in + */ + $returnContact = $cc->updateContact(ACCESS_TOKEN, $contact, false); } - - // catch any exceptions thrown during the process and print the errors to screen + + // catch any exceptions thrown during the process and print the errors to screen } catch (CtctException $ex) { - echo 'Error '.$action.''; + echo 'Error ' . $action . ''; echo '
';
-        print_r($ex->getErrors()); 
+        print_r($ex->getErrors());
         echo '
'; die(); } -} +} ?> -
-

Add or Update a Contact

-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ -
+
-
-
+
+
-
-
- - -
';
-        print_r($returnContact); 
-        echo '
'; - } ?> + + + + + +
';
+    print_r($returnContact);
+    echo '
'; +} ?> \ No newline at end of file diff --git a/examples/createAndScheduleCampaign.php b/examples/createAndScheduleCampaign.php index 032d103..2312898 100644 --- a/examples/createAndScheduleCampaign.php +++ b/examples/createAndScheduleCampaign.php @@ -4,9 +4,20 @@ Constant Contact API v2 Create/Schedule Campaign Example - + + + name = $params['name']; @@ -50,9 +57,9 @@ function createCampaign(array $params) { if (count($params['lists']) > 1) { foreach ($params['lists'] as $list) { $campaign->addList($list); - } + } } else { - $campaign->addList($params['lists']); + $campaign->addList($params['lists'][0]); } } @@ -60,168 +67,186 @@ function createCampaign(array $params) { } /** - * Create a schedule for a campaign + * Create a schedule for a campaign - this is time the campaign will be sent out * @param $campaignId - Id of the campaign to be scheduled * @param $time - ISO 8601 formatted timestamp of when the campaign should be sent - */ -function createSchedule($campaignId, $time) { + */ +function createSchedule($campaignId, $time) +{ $cc = new ConstantContact(APIKEY); $schedule = new Schedule(); $schedule->scheduled_date = $time; return $cc->addEmailCampaignSchedule(ACCESS_TOKEN, $campaignId, $schedule); } +// check to see if the form was submitted if (isset($_POST['name'])) { - // attempt to create a campaign with the fields submitted - try{ + // attempt to create a campaign with the fields submitted, displaying any errors that occur + try { $campaign = createCampaign($_POST); } catch (CtctException $ex) { echo 'Error Creating Campaign'; echo '
';
-        print_r($ex->getErrors()); 
+        print_r($ex->getErrors());
         echo '
'; die(); } - // attempt to schedule a campaign with the fields submitted + // attempt to schedule a campaign with the fields submitted, displaying any errors that occur try { $schedule = createSchedule($campaign->id, $_POST['schedule_time']); } catch (CtctException $ex) { echo 'Error Scheduling Campaign'; echo '
';
-        print_r($ex->getErrors()); 
+        print_r($ex->getErrors());
         echo '
'; die(); } - + } -try{ +// attempt to get the lists in this account, displaying any errors that occur +try { $lists = $cc->getLists(ACCESS_TOKEN); } catch (CtctException $ex) { echo '
';
-    print_r($ex->getErrors()); 
+    print_r($ex->getErrors());
     echo '
'; die(); } ?> -
-

Create and Schedule a Campaign

-
+
+

Create and Schedule a Campaign

+ +
-
- -
- +
+ + +
+ +
-
-
- -
- +
+ + +
+ +
-
-
- -
- +
+ + +
+ +
-
-
- -
- +
+ + +
+ +
-
-
- -
- +
+ + +
+ +
-
-
- -
- +
+ + +
+ +
-
- +
-
- -
- +
+ + +
+ +
-
-
- -
- +
+ + +
+ +
-
-
- -
- -
-
-
- -
- "/> -
-
-
- -
- HTML - XHTML +
+ + +
+ +
+
+
+ + +
+ "/> +
-
-
+
+ + +
+ HTML + XHTML +
+
+

+
+
+ +
+
-
-
+ + - Campaign Created!'; - echo '
';
-        print_r($campaign); 
-        echo '
'; - } +// print the contents of the campaign to screen +if (isset($campaign)) { + echo 'Campaign Created!'; + echo '
';
+    print_r($campaign);
+    echo '
'; +} - // print the contents of the schedule to screen - if (isset($schedule)) { - echo 'Campaign Scheduled!'; - echo '
';
-        print_r($schedule); 
-        echo '
'; - } - ?> +// print the contents of the schedule to screen +if (isset($schedule)) { + echo 'Campaign Scheduled!'; + echo '
';
+    print_r($schedule);
+    echo '
'; +} +?> \ No newline at end of file diff --git a/examples/getAccessToken.php b/examples/getAccessToken.php index a905815..3d490bb 100644 --- a/examples/getAccessToken.php +++ b/examples/getAccessToken.php @@ -1,62 +1,74 @@ + + + + Constant Contact API v2 OAuth2 Example + + + + + + - - - - Constant Contact API v2 OAuth2 Example - - - - -
-

OAuth 2 Authorization Example

+
+

OAuth 2 Authorization Example

-OAuth2 Error!'; - echo '
';
-    echo 'Error: ' . $_GET['error'];
-    echo '
Description: ' . $_GET['error_description']; - echo '
'; - die(); -} - -// If 'code' is detected in the uri, the code can now be exchanged for an access token -if (isset($_GET['code'])) { - try{ - $accessToken = $oauth->getAccessToken($_GET['code']); - } catch (OAuth2Exception $ex) { + OAuth2 Error!'; echo '
';
-        echo 'Error: ' . $ex->getMessage();
+        echo 'Error: ' . $_GET['error'];
+        echo '
Description: ' . $_GET['error_description']; echo '
'; die(); } - echo 'Access Token Retrieved!'; - echo '
';
-    print_r($accessToken); 
-    echo '
'; + // If the 'code' query parameter is present in the uri, the code can exchanged for an access token + if (isset($_GET['code'])) { + try { + $accessToken = $oauth->getAccessToken($_GET['code']); + } catch (OAuth2Exception $ex) { + echo 'OAuth2 Error!'; + echo '
';
+            echo 'Error: ' . $ex->getMessage();
+            echo '
'; + die(); + } -} else { -?> - - -
+ echo 'Access Token Retrieved!'; + echo '
';
+        print_r($accessToken);
+        echo '
'; + + } else { + ?> + + + +
diff --git a/examples/styles.css b/examples/styles.css index 60520fb..f550c65 100644 --- a/examples/styles.css +++ b/examples/styles.css @@ -1,9 +1,9 @@ -.success-pre{ +.success-pre { background-color: #DFF0D8; border-color: #D6E9C6; } -.failure-pre{ +.failure-pre { background-color: #F2DEDE; border-color: #EED3D7; } \ No newline at end of file diff --git a/phpunit.xml b/phpunit.xml index b0bd2cc..f7844eb 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,8 +1,8 @@ - - - ./test/services - ./test/auth - - + + + test/Services + test/Auth + + \ No newline at end of file diff --git a/src/Ctct/Auth/CtctDataStore.php b/src/Ctct/Auth/CtctDataStore.php index c204ca9..c333bc1 100644 --- a/src/Ctct/Auth/CtctDataStore.php +++ b/src/Ctct/Auth/CtctDataStore.php @@ -7,30 +7,30 @@ * @package Auth * @author Constant Contact */ - + interface CtctDataStore { - + /** * Add a new user to the data store * @param $id - unique identifier * @param array $params - additional parameters */ public function addUser($id, array $params); - + /** * Get an existing user from the data store * @param $id - unique identifier */ public function getUser($id); - + /** * Update an existing user in the data store * @param $id - unique identifier * @param array $params - additional parameters */ public function updateUser($id, array $params); - + /** * Delete an existing user from the data store * @param $id - unique identifier diff --git a/src/Ctct/Auth/SessionDataStore.php b/src/Ctct/Auth/SessionDataStore.php index 5ef0f7b..b5c7d60 100755 --- a/src/Ctct/Auth/SessionDataStore.php +++ b/src/Ctct/Auth/SessionDataStore.php @@ -1,8 +1,6 @@ lists = $lists; - + if (empty($columnNames)) { $usedColumns[] = Config::get('activities_columns.email'); $contact = $contacts[0]; diff --git a/src/Ctct/Components/Activities/AddContactsImportData.php b/src/Ctct/Components/Activities/AddContactsImportData.php index 9e35627..94a2e34 100644 --- a/src/Ctct/Components/Activities/AddContactsImportData.php +++ b/src/Ctct/Components/Activities/AddContactsImportData.php @@ -2,10 +2,9 @@ namespace Ctct\Components\Activities; use Ctct\Components\Component; -use Ctct\Components\Contacts\Contact; use Ctct\Components\Contacts\Address; use Ctct\Components\Contacts\CustomField; - + /** * Represents a single Activity in Constant Contact * @@ -30,7 +29,6 @@ class AddContactsImportData extends Component /** * Factory method to create an Activity object from an array * @param array $props - associative array of initial properties to set - * @return Campaign */ public function __construct(array $props = array()) { @@ -46,8 +44,10 @@ public function addCustomField(CustomField $customField) public function addAddress(Address $address) { - $address->state_code = $address->state; - unset($address->state); + if (isset($address->state)) { + $address->state_code = $address->state; + unset($address->state); + } foreach ($address as $key => $value) { if ($value == null) { diff --git a/src/Ctct/Components/Activities/ExportContacts.php b/src/Ctct/Components/Activities/ExportContacts.php index 64c1742..597b114 100644 --- a/src/Ctct/Components/Activities/ExportContacts.php +++ b/src/Ctct/Components/Activities/ExportContacts.php @@ -2,7 +2,7 @@ namespace Ctct\Components\Activities; use Ctct\Components\Component; - + /** * Represents an Export Contacts Activity in Constant Contact * @@ -32,8 +32,8 @@ public function __construct(Array $lists = null) } /** - * Create json used for a POST/PUT request, also handles removing attributes that will cause errors if sent - * @return string + * Create json used for a POST/PUT request, also handles removing attributes that will cause errors if sent + * @return string */ public function toJson() { diff --git a/src/Ctct/Components/Contacts/Address.php b/src/Ctct/Components/Contacts/Address.php index 550f5a8..7a5931c 100755 --- a/src/Ctct/Components/Contacts/Address.php +++ b/src/Ctct/Components/Contacts/Address.php @@ -55,6 +55,12 @@ class Address extends Component */ public $state_code; + /** + * The state for this address (non-US/Canada) + * + */ + public $state; + /** * The country code for this address * @var string @@ -88,6 +94,7 @@ public static function create(array $props) $address->city = parent::getValue($props, "city"); $address->address_type = parent::getValue($props, "address_type"); $address->state_code = parent::getValue($props, "state_code"); + $address->state = parent::getValue($props, "state"); $address->country_code = parent::getValue($props, "country_code"); $address->postal_code = parent::getValue($props, "postal_code"); $address->sub_postal_code = parent::getValue($props, "sub_postal_code"); diff --git a/src/Ctct/Components/Contacts/Contact.php b/src/Ctct/Components/Contacts/Contact.php index 18ffed8..c6a3f68 100755 --- a/src/Ctct/Components/Contacts/Contact.php +++ b/src/Ctct/Components/Contacts/Contact.php @@ -1,8 +1,7 @@ last_name = parent::getValue($props, "last_name"); $contact->confirmed = parent::getValue($props, "confirmed"); $contact->source = parent::getValue($props, "source"); - - foreach ($props['email_addresses'] as $email_address) { - $contact->email_addresses[] = EmailAddress::create($email_address); + + if (isset($props['email_addresses'])) { + foreach ($props['email_addresses'] as $email_address) { + $contact->email_addresses[] = EmailAddress::create($email_address); + } } - + $contact->prefix_name = parent::getValue($props, "prefix_name"); $contact->job_title = parent::getValue($props, "job_title"); - foreach ($props['addresses'] as $address) { - $contact->addresses[] = Address::create($address); + if (isset($props['addresses'])) { + foreach ($props['addresses'] as $address) { + $contact->addresses[] = Address::create($address); + } } - - foreach ($props['notes'] as $note) { - $contact->notes[] = Note::create($note); + + if (isset($props['notes'])) { + foreach ($props['notes'] as $note) { + $contact->notes[] = Note::create($note); + } } - + $contact->company_name = parent::getValue($props, "company_name"); $contact->home_phone = parent::getValue($props, "home_phone"); $contact->work_phone = parent::getValue($props, "work_phone"); $contact->cell_phone = parent::getValue($props, "cell_phone"); $contact->fax = parent::getValue($props, "fax"); - - foreach ($props['custom_fields'] as $custom_field) { - $contact->custom_fields[] = CustomField::create($custom_field); + + if (isset($props['custom_fields'])) { + foreach ($props['custom_fields'] as $custom_field) { + $contact->custom_fields[] = CustomField::create($custom_field); + } } - - foreach ($props['lists'] as $contact_list) { - $contact->lists[] = ContactList::create($contact_list); + + if (isset($props['lists'])) { + foreach ($props['lists'] as $contact_list) { + $contact->lists[] = ContactList::create($contact_list); + } } - + + $contact->created_date = parent::getValue($props, "created_date"); + $contact->modified_date = parent::getValue($props, "modified_date"); + $contact->source_details = parent::getValue($props, "source_details"); return $contact; @@ -196,17 +220,17 @@ public function addList($contactList) $this->lists[] = $contactList; } - + /** * Add an EmailAddress * @param mixed $emailAddress - EmailAddress object or email address */ public function addEmail($emailAddress) { - if (! $emailAddress instanceof EmailAddress) { + if (!$emailAddress instanceof EmailAddress) { $emailAddress = new EmailAddress($emailAddress); } - + $this->email_addresses[] = $emailAddress; } @@ -218,7 +242,7 @@ public function addCustomField(CustomField $customField) { $this->custom_fields[] = $customField; } - + /** * Add an address * @param Address $address - Address to add @@ -227,7 +251,7 @@ public function addAddress(Address $address) { $this->addresses[] = $address; } - + public function toJson() { unset($this->last_update_date); diff --git a/src/Ctct/Components/Contacts/ContactList.php b/src/Ctct/Components/Contacts/ContactList.php index eb5e8e0..f145eb6 100755 --- a/src/Ctct/Components/Contacts/ContactList.php +++ b/src/Ctct/Components/Contacts/ContactList.php @@ -1,6 +1,6 @@ id = $list_id; } - + return $this; } @@ -57,9 +57,11 @@ public static function create(array $props) $contact_list->name = parent::getValue($props, "name"); $contact_list->status = parent::getValue($props, "status"); $contact_list->contact_count = parent::getValue($props, "contact_count"); + $contact_list->created_date = parent::getValue($props, "created_date"); + $contact_list->modified_date = parent::getValue($props, "modified_date"); return $contact_list; } - + public function toJson() { return json_encode($this); diff --git a/src/Ctct/Components/Contacts/CustomField.php b/src/Ctct/Components/Contacts/CustomField.php index 2124fe9..b8398c9 100755 --- a/src/Ctct/Components/Contacts/CustomField.php +++ b/src/Ctct/Components/Contacts/CustomField.php @@ -1,6 +1,6 @@ email_address = $email_address; } - + return $this; } diff --git a/src/Ctct/Components/Contacts/Note.php b/src/Ctct/Components/Contacts/Note.php index 77294dc..f24ba81 100755 --- a/src/Ctct/Components/Contacts/Note.php +++ b/src/Ctct/Components/Contacts/Note.php @@ -17,13 +17,13 @@ class Note extends Component * @var string */ public $id; - + /** * Content of the note * @var string */ public $note; - + /** * Date the note was created * @var string diff --git a/src/Ctct/Components/EmailMarketing/Campaign.php b/src/Ctct/Components/EmailMarketing/Campaign.php index dbeee8c..2fc44dd 100755 --- a/src/Ctct/Components/EmailMarketing/Campaign.php +++ b/src/Ctct/Components/EmailMarketing/Campaign.php @@ -1,11 +1,9 @@ greeting_salutations = parent::getValue($props, "greeting_salutations"); $campaign->greeting_name = parent::getValue($props, "greeting_name"); $campaign->greeting_string = parent::getValue($props, "greeting_string"); - + if (array_key_exists("message_footer", $props)) { $campaign->message_footer = MessageFooter::create($props['message_footer']); } - + if (array_key_exists("tracking_summary", $props)) { $campaign->tracking_summary = TrackingSummary::create($props['tracking_summary']); } - + $campaign->email_content = parent::getValue($props, "email_content"); $campaign->email_content_format = parent::getValue($props, "email_content_format"); $campaign->style_sheet = parent::getValue($props, "style_sheet"); $campaign->text_content = parent::getValue($props, "text_content"); - + $campaign->permalink_url = parent::getValue($props, "permalink_url"); + if (array_key_exists('sent_to_contact_lists', $props)) { foreach ($props['sent_to_contact_lists'] as $sent_to_contact_list) { $campaign->sent_to_contact_lists[] = ContactList::create($sent_to_contact_list); @@ -241,7 +246,7 @@ public static function create(array $props) $campaign->click_through_details[] = ClickThroughDetails::create($click_through_details); } } - + return $campaign; } @@ -271,6 +276,7 @@ public static function createSummary(array $props) /** * Add a contact list to set of lists associated with this email * @param mixed $contact_list - Contact list id, or ContactList object + * @throws IllegalArgumentException */ public function addList($contact_list) { @@ -281,13 +287,13 @@ public function addList($contact_list) } else { throw new IllegalArgumentException(sprintf(Config::get('errors.id_or_object'), 'ContactList')); } - + $this->sent_to_contact_lists[] = $list; } - + /** - * Create json used for a POST/PUT request, also handles removing attributes that will cause errors if sent - * @return string + * Create json used for a POST/PUT request, also handles removing attributes that will cause errors if sent + * @return string */ public function toJson() { @@ -314,7 +320,7 @@ public function toJson() unset($list->status); } } - + return json_encode($campaign); } } diff --git a/src/Ctct/Components/EmailMarketing/ClickThroughDetails.php b/src/Ctct/Components/EmailMarketing/ClickThroughDetails.php index 9bc1d67..29fe7e3 100755 --- a/src/Ctct/Components/EmailMarketing/ClickThroughDetails.php +++ b/src/Ctct/Components/EmailMarketing/ClickThroughDetails.php @@ -4,7 +4,7 @@ use Ctct\Components\Component; /** - * Represents a click through detail + * Represents a click through detail * * @package EmailMarketing * @subpackage Campaigns @@ -17,16 +17,16 @@ class ClickThroughDetails extends Component * @var string */ public $url; - + /** * url unique identifier - * @var string + * @var string */ public $url_uid; - + /** * number of times the url was clicked on - * @var int + * @var int */ public $click_count; diff --git a/src/Ctct/Components/EmailMarketing/MessageFooter.php b/src/Ctct/Components/EmailMarketing/MessageFooter.php index 3a306f3..c984086 100755 --- a/src/Ctct/Components/EmailMarketing/MessageFooter.php +++ b/src/Ctct/Components/EmailMarketing/MessageFooter.php @@ -47,7 +47,7 @@ public static function create(array $props) $message_footer->forward_email_link_text = parent::getValue($props, "forward_email_link_text"); $message_footer->include_subscribe_link = parent::getValue($props, "include_subscribe_link"); $message_footer->subscribe_link_text = parent::getValue($props, "subscribe_link_text"); - + return $message_footer; } } diff --git a/src/Ctct/Components/EmailMarketing/Schedule.php b/src/Ctct/Components/EmailMarketing/Schedule.php index 573dfb6..a0b5ec0 100755 --- a/src/Ctct/Components/EmailMarketing/Schedule.php +++ b/src/Ctct/Components/EmailMarketing/Schedule.php @@ -1,6 +1,6 @@ scheduled_date = parent::getValue($props, "scheduled_date"); return $schedule; } - + /** - * Create json used for a POST/PUT request, also handles removing attributes that will cause errors if sent - * @return string + * Create json used for a POST/PUT request, also handles removing attributes that will cause errors if sent + * @return string */ public function toJson() { diff --git a/src/Ctct/Components/ResultSet.php b/src/Ctct/Components/ResultSet.php index 3d39410..075c871 100644 --- a/src/Ctct/Components/ResultSet.php +++ b/src/Ctct/Components/ResultSet.php @@ -3,7 +3,7 @@ /** * Container for a get on a collection, such as Contacts, Campaigns, or TrackingData. - * + * */ class ResultSet { @@ -30,7 +30,7 @@ public function __construct(array $results, array $meta) if (array_key_exists('next_link', $meta['pagination'])) { $nextLink = $meta['pagination']['next_link']; - $this->next = substr($nextLink, strpos($nextLink, '?')); + $this->next = substr($nextLink, strpos($nextLink, '?') + 6); } } } diff --git a/src/Ctct/Components/Tracking/BounceActivity.php b/src/Ctct/Components/Tracking/BounceActivity.php index a084649..0b354f1 100755 --- a/src/Ctct/Components/Tracking/BounceActivity.php +++ b/src/Ctct/Components/Tracking/BounceActivity.php @@ -1,5 +1,4 @@ activity_type = parent::getValue($props, "activity_type"); - $click_activity->campaign_id= parent::getValue($props, "campaign_id"); + $click_activity->campaign_id = parent::getValue($props, "campaign_id"); $click_activity->contact_id = parent::getValue($props, "contact_id"); $click_activity->email_address = parent::getValue($props, "email_address"); $click_activity->link_id = parent::getValue($props, "link_id"); diff --git a/src/Ctct/Components/Tracking/ForwardActivity.php b/src/Ctct/Components/Tracking/ForwardActivity.php index 5866a74..022f96f 100755 --- a/src/Ctct/Components/Tracking/ForwardActivity.php +++ b/src/Ctct/Components/Tracking/ForwardActivity.php @@ -1,5 +1,4 @@ results = $results; if (array_key_exists('next', $pagination)) { - $this->next = substr($pagination['next'], strrpos($pagination['next'], '&next=')+6); + $this->next = substr($pagination['next'], strrpos($pagination['next'], '&next=') + 6); } } } diff --git a/src/Ctct/Components/Tracking/TrackingSummary.php b/src/Ctct/Components/Tracking/TrackingSummary.php index 83c6e46..b093b6d 100755 --- a/src/Ctct/Components/Tracking/TrackingSummary.php +++ b/src/Ctct/Components/Tracking/TrackingSummary.php @@ -1,5 +1,4 @@ forwards = parent::getValue($props, "forwards"); $tracking_summary->unsubscribes = parent::getValue($props, "unsubscribes"); $tracking_summary->bounces = parent::getValue($props, "bounces"); + $tracking_summary->spam_count = parent::getValue($props, "spam_count"); + + // Contacts don't have spam_count, only Campaigns + if(is_null($tracking_summary->spam_count)) { + unset($tracking_summary->spam_count); + } + return $tracking_summary; } } diff --git a/src/Ctct/ConstantContact.php b/src/Ctct/ConstantContact.php index ce6ea42..a3ba228 100755 --- a/src/Ctct/ConstantContact.php +++ b/src/Ctct/ConstantContact.php @@ -1,7 +1,6 @@ api_key = $apiKey; + $this->apiKey = $apiKey; $this->contactService = new ContactService($apiKey); $this->emailMarketingService = new EmailMarketingService($apiKey); $this->activityService = new ActivityService($apiKey); @@ -103,20 +103,24 @@ public function __construct($apiKey) $this->listService = new ListService($apiKey); $this->accountService = new AccountService($apiKey); } - + /** * Get a set of campaigns * @param string $accessToken - Constant Contact OAuth2 access token - * @param mixed $param - denotes the number of results per set, limited to 50, or a next parameter provided - * from a previous getContacts call - * @return ResultSet + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * modified_since - ISO-8601 formatted timestamp. + * next - the next link returned from a previous paginated call. May only be used by itself. + * email - the contact by email address to retrieve information for. + * status - a contact status to filter results by. Must be one of ACTIVE, OPTOUT, REMOVED, UNCONFIRMED. + * @return ResultSet containing a results array of {@link Ctct\Components\Contacts\Contact} */ - public function getContacts($accessToken, $param = null) + public function getContacts($accessToken, array $params = array()) { - $param = $this->determineParam($param); - return $this->contactService->getContacts($accessToken, $param); + return $this->contactService->getContacts($accessToken, $params); } - + /** * Get an individual contact * @param string $accessToken - Valid access token @@ -127,9 +131,9 @@ public function getContact($accessToken, $contactId) { return $this->contactService->getContact($accessToken, $contactId); } - + /** - * Get contacts with a specified email eaddress + * Get contacts with a specified email address * @param string $accessToken - Constant Contact OAuth2 access token * @param string $email - contact email address to search for * @return ResultSet @@ -138,19 +142,23 @@ public function getContactByEmail($accessToken, $email) { return $this->contactService->getContacts($accessToken, array('email' => $email)); } - + /** * Add a new contact to an account * @param string $accessToken - Valid access token * @param Contact $contact - Contact to add - * @param boolean $actionByVisitor - is the action being taken by the visitor + * @param boolean $actionByVisitor - is the action being taken by the visitor * @return Contact */ public function addContact($accessToken, Contact $contact, $actionByVisitor = false) { - return $this->contactService->addContact($accessToken, $contact, $actionByVisitor); + $params = array(); + if ($actionByVisitor == true) { + $params['action_by'] = "ACTION_BY_VISITOR"; + } + return $this->contactService->addContact($accessToken, $contact, $params); } - + /** * Sets an individual contact to 'REMOVED' status * @param string $accessToken - Valid access token @@ -163,7 +171,7 @@ public function deleteContact($accessToken, $contact) $contactId = $this->getArgumentId($contact, 'Contact'); return $this->contactService->deleteContact($accessToken, $contactId); } - + /** * Delete a contact from all contact lists * @param string $accessToken - Constant Contact OAuth2 access token @@ -182,7 +190,7 @@ public function deleteContactFromLists($accessToken, $contact) * @param string $accessToken - Constant Contact OAuth2 access token * @param mixed $contact - Contact id or a Contact object * @param mixed $list - ContactList id or a ContactList object - * @throws IllegalArgumentException - if an int or Contact object is not provided, + * @throws IllegalArgumentException - if an int or Contact object is not provided, * as well as an int or ContactList object * @return boolean */ @@ -190,32 +198,39 @@ public function deleteContactFromList($accessToken, $contact, $list) { $contactId = $this->getArgumentId($contact, 'Contact'); $listId = $this->getArgumentId($list, 'ContactList'); - + return $this->contactService->deleteContactFromList($accessToken, $contactId, $listId); } - + /** * Update an individual contact * @param string $accessToken - Valid access token * @param Contact $contact - Contact to update - * @param boolean $actionByVisitor - is the action being taken by the visitor, default is false + * @param boolean $actionByVisitor - is the action being taken by the visitor, default is false * @return Contact */ public function updateContact($accessToken, Contact $contact, $actionByVisitor = false) { - return $this->contactService->updateContact($accessToken, $contact, $actionByVisitor); + $params = array(); + if ($actionByVisitor == true) { + $params['action_by'] = "ACTION_BY_VISITOR"; + } + return $this->contactService->updateContact($accessToken, $contact, $params); } - + /** * Get lists * @param string $accessToken - Valid access token - * @return array + * @param array $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * modified_since - ISO-8601 formatted timestamp. + * @return array of ContactList */ - public function getLists($accessToken) + public function getLists($accessToken, array $params = array()) { - return $this->listService->getLists($accessToken); + return $this->listService->getLists($accessToken, $params); } - + /** * Get an individual list * @param string $accessToken - Valid access token @@ -226,7 +241,7 @@ public function getList($accessToken, $listId) { return $this->listService->getList($accessToken, $listId); } - + /** * Add a new contact list to an account * @param string $accessToken - Valid access token @@ -237,7 +252,7 @@ public function addList($accessToken, ContactList $list) { return $this->listService->addList($accessToken, $list); } - + /** * Update a contact list * @param string $accessToken - Valid access token @@ -249,6 +264,17 @@ public function updateList($accessToken, ContactList $list) return $this->listService->updateList($accessToken, $list); } + /** + * Delete a contact list from an account + * @param string $accessToken - Valid access token + * @param int $listId - Id of the list to delete + * @return boolean + */ + public function deleteList($accessToken, $listId) + { + return $this->listService->deleteList($accessToken, $listId); + } + /** * Get contact that belong to a specific list * @param string $accessToken - Constant Contact OAuth2 access token @@ -264,46 +290,47 @@ public function getContactsFromList($accessToken, $list, $param = null) $param = $this->determineParam($param); return $this->listService->getContactsFromList($accessToken, $listId, $param); } - + /** * Get a set of campaigns * @param string $accessToken - Constant Contact OAuth2 access token - * @param mixed $param - denotes the number of results per set, limited to 50, or a next parameter provided - * from a previous getCampaigns call - * @return ResultSet + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * modified_since - ISO-8601 formatted timestamp. + * next - the next link returned from a previous paginated call. May only be used by itself. + * email - the contact by email address to retrieve information for + * @return ResultSet containing a results array of {@link Ctct\Components\EmailMarketing\Campaign} */ - public function getEmailCampaigns($accessToken, $status = null, $param = null) + public function getEmailCampaigns($accessToken, array $params = array()) { - $params = $this->determineParam($param); - if ($status) { - $params['status'] = $status; - } return $this->emailMarketingService->getCampaigns($accessToken, $params); } - + /** * Get an individual campaign * @param string $accessToken - Constant Contact OAuth2 access token * @param int $campaignId - Valid campaign id + * @return \Ctct\Components\EmailMarketing\Campaign */ public function getEmailCampaign($accessToken, $campaignId) { return $this->emailMarketingService->getCampaign($accessToken, $campaignId); } - + /** * Delete an individual campaign * @param string $accessToken - Constant Contact OAuth2 access token * @param mixed $campaign - Id of a campaign or a Campaign object itself * @throws IllegalArgumentException - if a Campaign object or campaign id is not passed - * @return boolean + * @return boolean */ public function deleteEmailCampaign($accessToken, $campaign) { $campaignId = $this->getArgumentId($campaign, 'Campaign'); return $this->emailMarketingService->deleteCampaign($accessToken, $campaignId); } - + /** * Create a new campaign * @param string $accessToken - Constant Contact OAuth2 access token @@ -314,7 +341,7 @@ public function addEmailCampaign($accessToken, Campaign $campaign) { return $this->emailMarketingService->addCampaign($accessToken, $campaign); } - + /** * Update a specific campaign * @param string $accessToken - Constant Contact OAuth2 access token @@ -325,20 +352,20 @@ public function updateEmailCampaign($accessToken, Campaign $campaign) { return $this->emailMarketingService->updateCampaign($accessToken, $campaign); } - + /** * Schedule a campaign to be sent * @param string $accessToken - Constant Contact OAuth2 access token * @param mixed $campaign - Campaign to be updated * @param Schedule $schedule - Schedule to be associated with the provided campaign - * @return Campaign - updated campaign + * @return Schedule schedule created */ public function addEmailCampaignSchedule($accessToken, $campaign, Schedule $schedule) { $campaignId = $this->getArgumentId($campaign, 'Campaign'); return $this->campaignScheduleService->addSchedule($accessToken, $campaignId, $schedule); } - + /** * Get an array of schedules associated with a given campaign * @param string $accessToken - Constant Contact OAuth2 access token @@ -350,7 +377,7 @@ public function getEmailCampaignSchedules($accessToken, $campaign) $campaignId = $this->getArgumentId($campaign, 'Campaign'); return $this->campaignScheduleService->getSchedules($accessToken, $campaignId); } - + /** * Get a specific schedule associated with a given campaign * @param string $accessToken - Constant Contact OAuth2 access token @@ -362,7 +389,6 @@ public function getEmailCampaignSchedules($accessToken, $campaign) public function getEmailCampaignSchedule($accessToken, $campaign, $schedule) { $campaignId = $this->getArgumentId($campaign, 'Campaign'); - $scheduleId = null; if ($schedule instanceof Schedule) { @@ -372,10 +398,10 @@ public function getEmailCampaignSchedule($accessToken, $campaign, $schedule) } else { throw new IllegalArgumentException(sprintf(Config::get('errors.id_or_object'), 'Schedule')); } - + return $this->campaignScheduleService->getSchedule($accessToken, $campaignId, $scheduleId); } - + /** * Update a specific schedule associated with a given campaign * @param string $accessToken - Constant Contact OAuth2 access token @@ -388,7 +414,7 @@ public function updateEmailCampaignSchedule($accessToken, $campaign, Schedule $s $campaignId = $this->getArgumentId($campaign, 'Campaign'); return $this->campaignScheduleService->updateSchedule($accessToken, $campaignId, $schedule); } - + /** * Delete a specific schedule associated with a given campaign * @param string $accessToken - Constant Contact OAuth2 access token @@ -401,7 +427,7 @@ public function deleteEmailCampaignSchedule($accessToken, $campaign, $schedule) { $campaignId = $this->getArgumentId($campaign, 'Campaign'); $scheduleId = null; - + if ($schedule instanceof Schedule) { $scheduleId = $schedule->id; } elseif (is_numeric($schedule)) { @@ -409,119 +435,129 @@ public function deleteEmailCampaignSchedule($accessToken, $campaign, $schedule) } else { throw new IllegalArgumentException(sprintf(Config::get('errors.id_or_object'), 'Schedule')); } - + return $this->campaignScheduleService->deleteSchedule($accessToken, $campaignId, $scheduleId); } /** * Send a test send of a campaign * @param string $accessToken - Constant Contact OAuth2 access token - * @param mixed $emailCampaign - Campaign id or Campaign object itself - * @param TestSend $test_send - test send details + * @param mixed $campaign - Campaign id or Campaign object itself + * @param TestSend $testSend - test send details * @return TestSend */ - public function sendEmailCampaignTest($accessToken, $campaign, TestSend $test_send) + public function sendEmailCampaignTest($accessToken, $campaign, TestSend $testSend) { $campaignId = $this->getArgumentId($campaign, 'Campaign'); - return $this->campaignScheduleService->sendTest($accessToken, $campaignId, $test_send); + return $this->campaignScheduleService->sendTest($accessToken, $campaignId, $testSend); } /** * Get sends for a campaign * @param string $accessToken - Constant Contact OAuth2 access token - * @param mixed $emailCampaign - Campaign id or Campaign object itself - * @param mixed $param - either the next link from a previous request, or a limit or restrict the page size of - * an initial request - * @return TrackingActivity - Containing a results array of {@link Ctct\Components\CampaignTracking\SendActivity} + * @param mixed $campaign - Campaign id or Campaign object itself + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). + * next - the next link returned from a previous paginated call. May only be used by itself. + * @return ResultSet - Containing a results array of {@link Ctct\Components\Tracking\SendActivity} */ - public function getEmailCampaignSends($accessToken, $campaign, $param = null) + public function getEmailCampaignSends($accessToken, $campaign, array $params = array()) { $campaignId = $this->getArgumentId($campaign, 'Campaign'); - $param = $this->determineParam($param); - return $this->campaignTrackingService->getSends($accessToken, $campaignId, $param); + return $this->campaignTrackingService->getSends($accessToken, $campaignId, $params); } /** * Get bounces for a campaign * @param string $accessToken - Constant Contact OAuth2 access token - * @param mixed $emailCampaign - Campaign id or Campaign object itself - * @param mixed $param - either the next link from a previous request, or a limit or restrict the page size of - * an initial request - * @return ResultSet - Containing a results array of {@link Ctct\Components\CampaignTracking\BounceActivity} + * @param mixed $campaign - Campaign id or Campaign object itself + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). + * next - the next link returned from a previous paginated call. May only be used by itself. + * @return ResultSet - Containing a results array of {@link Ctct\Components\Tracking\BounceActivity} */ - public function getEmailCampaignBounces($accessToken, $campaign, $param = null) + public function getEmailCampaignBounces($accessToken, $campaign, array $params = array()) { $campaignId = $this->getArgumentId($campaign, 'Campaign'); - $param = $this->determineParam($param); - return $this->campaignTrackingService->getBounces($accessToken, $campaignId, $param); + return $this->campaignTrackingService->getBounces($accessToken, $campaignId, $params); } /** * Get clicks for a campaign * @param string $accessToken - Constant Contact OAuth2 access token - * @param mixed $emailCampaign - Campaign id or Campaign object itself - * @param mixed $param - either the next link from a previous request, or a limit or restrict the page size of - * an initial request - * @return ResultSet - Containing a results array of {@link Ctct\Components\CampaignTracking\ClickActivity} + * @param mixed $campaign - Campaign id or Campaign object itself + * @param array $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). + * next - the next link returned from a previous paginated call. May only be used by itself. + * @return ResultSet - Containing a results array of {@link Ctct\Components\Tracking\ClickActivity} */ - public function getEmailCampaignClicks($accessToken, $campaign, $param = null) + public function getEmailCampaignClicks($accessToken, $campaign, array $params = array()) { $campaignId = $this->getArgumentId($campaign, 'Campaign'); - $param = $this->determineParam($param); - return $this->campaignTrackingService->getClicks($accessToken, $campaignId, $param); + return $this->campaignTrackingService->getClicks($accessToken, $campaignId, $params); } /** * Get opens for a campaign * @param string $accessToken - Constant Contact OAuth2 access token - * @param mixed $emailCampaign - Campaign id or Campaign object itself - * @param mixed $param - either the next link from a previous request, or a limit or restrict the page size of - * an initial request - * @return ResultSet - Containing a results array of {@link Ctct\Components\CampaignTracking\OpenActivity} + * @param mixed $campaign - Campaign id or Campaign object itself + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). + * next - the next link returned from a previous paginated call. May only be used by itself. + * @return ResultSet - Containing a results array of {@link Ctct\Components\Tracking\OpenActivity} */ - public function getEmailCampaignOpens($accessToken, $campaign, $param = null) + public function getEmailCampaignOpens($accessToken, $campaign, array $params = array()) { $campaignId = $this->getArgumentId($campaign, 'Campaign'); - $param = $this->determineParam($param); - return $this->campaignTrackingService->getOpens($accessToken, $campaignId, $param); + return $this->campaignTrackingService->getOpens($accessToken, $campaignId, $params); } /** * Get forwards for a campaign * @param string $accessToken - Constant Contact OAuth2 access token - * @param mixed $emailCampaign - Campaign id or Campaign object itself - * @param mixed $param - either the next link from a previous request, or a limit or restrict the page size of - * an initial request - * @return ResultSet - Containing a results array of {@link Ctct\Components\CampaignTracking\ForwardActivity} + * @param mixed $campaign - Campaign id or Campaign object itself + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). + * next - the next link returned from a previous paginated call. May only be used by itself. + * @return ResultSet - Containing a results array of {@link Ctct\Components\Tracking\ForwardActivity} */ - public function getEmailCampaignForwards($accessToken, $campaign, $param = null) + public function getEmailCampaignForwards($accessToken, $campaign, array $params = array()) { $campaignId = $this->getArgumentId($campaign, 'Campaign'); - $param = $this->determineParam($param); - return $this->campaignTrackingService->getForwards($accessToken, $campaignId, $param); + return $this->campaignTrackingService->getForwards($accessToken, $campaignId, $params); } /** * Get unsubscribes for a campaign * @param string $accessToken - Constant Contact OAuth2 access token - * @param mixed $emailCampaign - Campaign id or Campaign object itself - * @param mixed $param - either the next link from a previous request, or a limit or restrict the page size of - * an initial request - * @return ResultSet - Containing a results array of {@link Ctct\Components\CampaignTracking\UnsubscribeActivity} + * @param mixed $campaign - Campaign id or Campaign object itself + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). + * next - the next link returned from a previous paginated call. May only be used by itself. + * @return ResultSet - Containing a results array of {@link Ctct\Components\Tracking\UnsubscribeActivity} */ - public function getEmailCampaignUnsubscribes($accessToken, $campaign, $param = null) + public function getEmailCampaignUnsubscribes($accessToken, $campaign, array $params = array()) { $campaignId = $this->getArgumentId($campaign, 'Campaign'); - $param = $this->determineParam($param); - return $this->campaignTrackingService->getUnsubscribes($accessToken, $campaignId, $param); + return $this->campaignTrackingService->getUnsubscribes($accessToken, $campaignId, $params); } /** * Get a reporting summary for a campaign * @param string $accessToken - Constant Contact OAuth2 access token - * @param mixed $emailCampaign - Campaign id or Campaign object itself - * @param string $next - next value returned from a previous request (used in pagination) - * @param int $limit - number of results to return per page + * @param mixed $campaign - Campaign id or Campaign object itself * @return TrackingSummary */ public function getEmailCampaignSummaryReport($accessToken, $campaign) @@ -534,90 +570,102 @@ public function getEmailCampaignSummaryReport($accessToken, $campaign) * Get sends for a Contact * @param string $accessToken - Constant Contact OAuth2 access token * @param mixed $contact - Contact id or Contact object itself - * @param mixed $param - either the next link from a previous request, or a limit or restrict the page size of - * an initial request + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). + * next - the next link returned from a previous paginated call. May only be used by itself. * @return ResultSet - Containing a results array of {@link Ctct\Components\Tracking\SendActivity} */ - public function getContactSends($accessToken, $contact, $param = null) + public function getContactSends($accessToken, $contact, array $params = array()) { $contactId = $this->getArgumentId($contact, 'Contact'); - $param = $this->determineParam($param); - return $this->contactTrackingService->getSends($accessToken, $contactId, $param); + return $this->contactTrackingService->getSends($accessToken, $contactId, $params); } /** * Get bounces for a Contact * @param string $accessToken - Constant Contact OAuth2 access token * @param mixed $contact - Contact id or Contact object itself - * @param mixed $param - either the next link from a previous request, or a limit or restrict the page size of - * an initial request + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). + * next - the next link returned from a previous paginated call. May only be used by itself. * @return ResultSet - Containing a results array of {@link Ctct\Components\Tracking\BounceActivity} */ - public function getContactBounces($accessToken, $contact, $param = null) + public function getContactBounces($accessToken, $contact, array $params = array()) { $contactId = $this->getArgumentId($contact, 'Contact'); - $param = $this->determineParam($param); - return $this->contactTrackingService->getBounces($accessToken, $contactId, $param); + return $this->contactTrackingService->getBounces($accessToken, $contactId, $params); } /** * Get clicks for a Contact * @param string $accessToken - Constant Contact OAuth2 access token * @param mixed $contact - Contact id or Contact object itself - * @param mixed $param - either the next link from a previous request, or a limit or restrict the page size of - * an initial request + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). + * next - the next link returned from a previous paginated call. May only be used by itself. * @return ResultSet - Containing a results array of {@link Ctct\Components\Tracking\ClickActivity} */ - public function getContactClicks($accessToken, $contact, $param = null) + public function getContactClicks($accessToken, $contact, array $params = array()) { $contactId = $this->getArgumentId($contact, 'Contact'); - $param = $this->determineParam($param); - return $this->contactTrackingService->getClicks($accessToken, $contactId, $param); + return $this->contactTrackingService->getClicks($accessToken, $contactId, $params); } /** * Get opens for a Contact * @param string $accessToken - Constant Contact OAuth2 access token * @param mixed $contact - Contact id or Contact object itself - * @param mixed $param - either the next link from a previous request, or a limit or restrict the page size of - * an initial request + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). + * next - the next link returned from a previous paginated call. May only be used by itself. * @return ResultSet - Containing a results array of {@link Ctct\Components\Tracking\OpenActivity} */ - public function getContactOpens($accessToken, $contact, $param = null) + public function getContactOpens($accessToken, $contact, array $params = array()) { $contactId = $this->getArgumentId($contact, 'Contact'); - $param = $this->determineParam($param); - return $this->contactTrackingService->getOpens($accessToken, $contactId, $param); + return $this->contactTrackingService->getOpens($accessToken, $contactId, $params); } /** * Get forwards for a Contact * @param string $accessToken - Constant Contact OAuth2 access token * @param mixed $contact - Contact id or Contact object itself - * @param mixed $param - either the next link from a previous request, or a limit or restrict the page size of - * an initial request + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). + * next - the next link returned from a previous paginated call. May only be used by itself. * @return ResultSet - Containing a results array of {@link Ctct\Components\Tracking\ForwardActivity} */ - public function getContactForwards($accessToken, $contact, $param = null) + public function getContactForwards($accessToken, $contact, array $params = array()) { $contactId = $this->getArgumentId($contact, 'Contact'); - $param = $this->determineParam($param); - return $this->contactTrackingService->getForwards($accessToken, $contactId, $param); + return $this->contactTrackingService->getForwards($accessToken, $contactId, $params); } /** * Get opt outs for a Contact * @param string $accessToken - Constant Contact OAuth2 access token * @param mixed $contact - Contact id or Contact object itself - * @param mixed $param - either the next link from a previous request, or a limit or restrict the page size of - * an initial request - * @return TrackingActivity - Containing a results array of {@link Ctct\Components\Tracking\UnsubscribeActivity} + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. + * created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). + * next - the next link returned from a previous paginated call. May only be used by itself. + * @return ResultSet - Containing a results array of {@link Ctct\Components\Tracking\UnsubscribeActivity} */ - public function getContactUnsubscribes($accessToken, $contact, $param = null) + public function getContactUnsubscribes($accessToken, $contact, array $params = array()) { $contactId = $this->getArgumentId($contact, 'Contact'); - $param = $this->determineParam($param); - return $this->contactTrackingService->getUnsubscribes($accessToken, $contactId, $param); + return $this->contactTrackingService->getUnsubscribes($accessToken, $contactId, $params); } /** @@ -639,8 +687,6 @@ public function getVerifiedEmailAddresses($accessToken, $status = null) * Get a reporting summary for a Contact * @param string $accessToken - Constant Contact OAuth2 access token * @param mixed $contact - Contact id or Contact object itself - * @param string $next - next value returned from a previous request (used in pagination) - * @param int $limit - number of results to return per page * @return TrackingSummary */ public function getContactSummaryReport($accessToken, $contact) @@ -652,18 +698,23 @@ public function getContactSummaryReport($accessToken, $contact) /** * Get an array of activities * @param string $accessToken - Constant Contact OAuth2 access token - * @return array + * @param array $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * status - Status of the activity, must be one of UNCONFIRMED, PENDING, QUEUED, RUNNING, COMPLETE, ERROR + * type - Type of activity, must be one of ADD_CONTACTS, REMOVE_CONTACTS_FROM_LISTS, CLEAR_CONTACTS_FROM_LISTS, + * EXPORT_CONTACTS + * @return Activity */ - public function getActivities($accessToken) + public function getActivities($accessToken, array $params = array()) { - return $this->activityService->getActivities($accessToken); + return $this->activityService->getActivities($accessToken, $params); } /** * Get a single activity by id * @param string $accessToken - Constant Contact OAuth2 access token * @param string $activityId - Activity id - * @return Activity + * @return Activity */ public function getActivity($accessToken, $activityId) { @@ -673,17 +724,32 @@ public function getActivity($accessToken, $activityId) /** * Add an AddContacts Activity to add contacts in bulk * @param string $accessToken - Constant Contact OAuth2 access token - * @param AddContacts - Add Contacts Activity + * @param AddContacts $addContactsActivity - Add Contacts Activity + * @return Activity */ public function addCreateContactsActivity($accessToken, AddContacts $addContactsActivity) { return $this->activityService->createAddContactsActivity($accessToken, $addContactsActivity); } + /** + * Create an Add Contacts Activity from a file. Valid file types are txt, csv, xls, xlsx + * @param string $accessToken - Constant Contact OAuth2 access token + * @param string $fileName - The name of the file (ie: contacts.csv) + * @param string $contents - The contents of the file + * @param string $lists - Comma separated list of ContactList id's to add the contacts to + * @return Activity + */ + public function addCreateContactsActivityFromFile($accessToken, $fileName, $contents, $lists) + { + return $this->activityService->createAddContactsActivityFromFile($accessToken, $fileName, $contents, $lists); + } + /** * Add an ClearLists Activity to remove all contacts from the provided lists * @param string $accessToken - Constant Contact OAuth2 access token - * @param AddContacts - Add Contacts Activity + * @param array $lists - Array of list id's to be cleared + * @return Activity */ public function addClearListsActivity($accessToken, Array $lists) { @@ -695,14 +761,32 @@ public function addClearListsActivity($accessToken, Array $lists) * @param string $accessToken - Constant Contact OAuth2 access token * @param array $emailAddresses - email addresses to be removed * @param array $lists - lists to remove the provided email addresses from - * @param AddContacts - Add Contacts Activity + * @return Activity */ public function addRemoveContactsFromListsActivity($accessToken, Array $emailAddresses, Array $lists) { return $this->activityService->addRemoveContactsFromListsActivity($accessToken, $emailAddresses, $lists); } - /** + /** + * Add a Remove Contacts From Lists Activity from a file. Valid file types are txt, csv, xls, xlsx + * @param string $accessToken - Constant Contact OAuth2 access token + * @param string $fileName - The name of the file (ie: contacts.csv) + * @param string $contents - The contents of the file + * @param string $lists - Comma separated list of ContactList id' to add the contacts too + * @return Activity + */ + public function addRemoveContactsFromListsActivityFromFile($accessToken, $fileName, $contents, $lists) + { + return $this->activityService->addRemoveContactsFromListsActivityFromFile( + $accessToken, + $fileName, + $contents, + $lists + ); + } + + /** * Create an Export Contacts Activity * @param string $accessToken - Constant Contact OAuth2 access token * @param ExportContacts $exportContacts @@ -712,25 +796,25 @@ public function addExportContactsActivity($accessToken, ExportContacts $exportCo { return $this->activityService->addExportContactsActivity($accessToken, $exportContacts); } - + /** * Get the id of object, or attempt to convert the argument to an int * @param mixed $item - object or a numeric value - * @param string $class_name - class name to test the given object against + * @param string $className - class name to test the given object against * @throws IllegalArgumentException - if the item is not an instance of the class name given, or cannot be * converted to a numeric value * @return int */ - private function getArgumentId($item, $class_name) + private function getArgumentId($item, $className) { $id = null; if (is_numeric($item)) { $id = $item; - } elseif (join('', array_slice(explode('\\', get_class($item)), -1)) == $class_name) { + } elseif (join('', array_slice(explode('\\', get_class($item)), -1)) == $className) { $id = $item->id; } else { - throw new IllegalArgumentException(sprintf(Config::get('errors.id_or_object'), $class_name)); + throw new IllegalArgumentException(sprintf(Config::get('errors.id_or_object'), $className)); } return $id; diff --git a/src/Ctct/Exceptions/CTCTException.php b/src/Ctct/Exceptions/CtctException.php old mode 100755 new mode 100644 similarity index 95% rename from src/Ctct/Exceptions/CTCTException.php rename to src/Ctct/Exceptions/CtctException.php index a5e0e75..bd8ee14 --- a/src/Ctct/Exceptions/CTCTException.php +++ b/src/Ctct/Exceptions/CtctException.php @@ -5,22 +5,22 @@ /** * General exception - * + * * @package exceptions * @author djellesma */ class CtctException extends Exception { - + private $errors; private $curlInfo; - - + + public function setErrors(array $errors) { $this->errors = $errors; } - + public function getErrors() { return $this->errors; diff --git a/src/Ctct/Exceptions/IllegalArgumentException.php b/src/Ctct/Exceptions/IllegalArgumentException.php index ceec033..5ffa639 100755 --- a/src/Ctct/Exceptions/IllegalArgumentException.php +++ b/src/Ctct/Exceptions/IllegalArgumentException.php @@ -5,7 +5,7 @@ /** * Exception thrown if there is an illegal argument passed to a particular method - * + * * @package exceptions * @author djellesma */ diff --git a/src/Ctct/Services/AccountService.php b/src/Ctct/Services/AccountService.php index a385f15..d821f1a 100644 --- a/src/Ctct/Services/AccountService.php +++ b/src/Ctct/Services/AccountService.php @@ -1,15 +1,14 @@ buildUrl($baseUrl, $params); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); $verifiedAddresses = array(); - + foreach (json_decode($response->body, true) as $verifiedAddress) { $verifiedAddresses[] = VerifiedEmailAddress::create($verifiedAddress); } - + return $verifiedAddresses; } } diff --git a/src/Ctct/Services/ActivityService.php b/src/Ctct/Services/ActivityService.php index 678d91e..ff9c5ce 100644 --- a/src/Ctct/Services/ActivityService.php +++ b/src/Ctct/Services/ActivityService.php @@ -1,15 +1,10 @@ buildUrl($baseUrl); + $url = $this->buildUrl($baseUrl, $params); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); $jsonResponse = json_decode($response->body, true); $activities = array(); @@ -39,11 +35,11 @@ public function getActivities($accessToken) } /** - * Get an array of activities - * @param string $accessToken - Constant Contact OAuth2 access token - * @param string $activityId - Activity id - * @return array - Array of all ActivitySummaryReports - */ + * Get an array of activities + * @param string $accessToken - Constant Contact OAuth2 access token + * @param string $activityId - Activity id + * @return array - Array of all ActivitySummaryReports + */ public function getActivity($accessToken, $activityId) { $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.activity'), $activityId); @@ -53,11 +49,11 @@ public function getActivity($accessToken, $activityId) } /** - * Create an Add Contacts Activity - * @param string $accessToken - Constant Contact OAuth2 access token - * @param AddContacts $addContact - * @return array - Array of all ActivitySummaryReports - */ + * Create an Add Contacts Activity + * @param string $accessToken - Constant Contact OAuth2 access token + * @param AddContacts $addContacts + * @return array - Array of all ActivitySummaryReports + */ public function createAddContactsActivity($accessToken, AddContacts $addContacts) { $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.add_contacts_activity'); @@ -67,12 +63,53 @@ public function createAddContactsActivity($accessToken, AddContacts $addContacts } /** - * Create a Clear Lists Activity - * @param string $accessToken - Constant Contact OAuth2 access token - * @param array $clearLists - Array of list id's to be cleared - * @return array - Array of all Activity - */ - public function addClearListsActivity($accessToken, Array $lists) + * Create an Add Contacts Activity from a file. Valid file types are txt, csv, xls, xlsx + * @param string $accessToken - Constant Contact OAuth2 access token + * @param string $fileName - The name of the file (ie: contacts.csv) + * @param string $contents - The contents of the file + * @param string $lists - Comma separated list of ContactList id's to add the contacts to + * @return \Ctct\Components\Activities\Activity + */ + public function createAddContactsActivityFromFile($accessToken, $fileName, $contents, $lists) + { + $eol = "\r\n"; + $data = ''; + $boundary=md5(time()); + + $data .= '--' . $boundary . $eol; + $data .= 'Content-Disposition: form-data; name="file_name"' . $eol; + $data .= 'Content-Type: text/plain' . $eol . $eol; + $data .= $fileName . $eol; + + $data .= '--' . $boundary . $eol; + $data .= 'Content-Disposition: form-data; name="lists"' . $eol; + $data .= 'Content-Type: text/plain' . $eol . $eol; + $data .= $lists . $eol; + + $data .= '--' . $boundary . $eol; + $data .= 'Content-Disposition: form-data; name="data"' . $eol . $eol; + $data .= $contents . $eol; + $data .= "--" . $boundary . "--" . $eol; + + $headers = array( + "Authorization: Bearer {$accessToken}", + "Content-Type: multipart/form-data; boundary={$boundary}" + ); + + $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.add_contacts_activity'); + $url = $this->buildUrl($baseUrl); + + $response = parent::getRestClient()->post($url, $headers, $data); + return Activity::create(json_decode($response->body, true)); + } + + /** + * Create a Clear Lists Activity + * @param string $accessToken - Constant Contact OAuth2 access token + * @param array $lists - Array of list id's to be cleared + * @return array - Array of all Activity + */ + public function addClearListsActivity($accessToken, array $lists) { $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.clear_lists_activity'); $url = $this->buildUrl($baseUrl); @@ -82,11 +119,11 @@ public function addClearListsActivity($accessToken, Array $lists) } /** - * Create an Export Contacts Activity - * @param string $accessToken - Constant Contact OAuth2 access token - * @param ExportContacts $exportContacts - * @return array - Array of all ActivitySummaryReports - */ + * Create an Export Contacts Activity + * @param string $accessToken - Constant Contact OAuth2 access token + * @param ExportContacts $exportContacts + * @return array - Array of all ActivitySummaryReports + */ public function addExportContactsActivity($accessToken, ExportContacts $exportContacts) { $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.export_contacts_activity'); @@ -96,18 +133,19 @@ public function addExportContactsActivity($accessToken, ExportContacts $exportCo } /** - * Create a Remove Contacts From Lists Activity - * @param string $accessToken - Constant Contact OAuth2 access token - * @param RemoveFromLists $removeFromLists - * @return array - Array of all ActivitySummaryReports - */ - public function addRemoveContactsFromListsActivity($accessToken, Array $emailAddresses, Array $lists) + * Create a Remove Contacts From Lists Activity + * @param string $accessToken - Constant Contact OAuth2 access token + * @param array $emailAddresses - array of email addresses to remove + * @param array $lists - array of lists to remove the provided email addresses from + * @return array - Array of all ActivitySummaryReports + */ + public function addRemoveContactsFromListsActivity($accessToken, array $emailAddresses, array $lists) { $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.remove_from_lists_activity'); $url = $this->buildUrl($baseUrl); $payload = array( - 'import_data' => array(), - 'lists' => $lists + 'import_data' => array(), + 'lists' => $lists ); foreach ($emailAddresses as $emailAddress) { @@ -117,4 +155,45 @@ public function addRemoveContactsFromListsActivity($accessToken, Array $emailAdd $response = parent::getRestClient()->post($url, parent::getHeaders($accessToken), json_encode($payload)); return Activity::create(json_decode($response->body, true)); } + + /** + * Create an Remove Contacts Activity from a file. Valid file types are txt, csv, xls, xlsx + * @param string $accessToken - Constant Contact OAuth2 access token + * @param string $fileName - The name of the file (ie: contacts.csv) + * @param string $contents - The contents of the file + * @param string $lists - Comma separated list of ContactList id' to add the contacts too + * @return \Ctct\Components\Activities\Activity + */ + public function addRemoveContactsFromListsActivityFromFile($accessToken, $fileName, $contents, $lists) + { + $eol = "\r\n"; + $data = ''; + $boundary=md5(time()); + + $data .= '--' . $boundary . $eol; + $data .= 'Content-Disposition: form-data; name="file_name"' . $eol; + $data .= 'Content-Type: text/plain' . $eol . $eol; + $data .= $fileName . $eol; + + $data .= '--' . $boundary . $eol; + $data .= 'Content-Disposition: form-data; name="lists"' . $eol; + $data .= 'Content-Type: text/plain' . $eol . $eol; + $data .= $lists . $eol; + + $data .= '--' . $boundary . $eol; + $data .= 'Content-Disposition: form-data; name="data"' . $eol . $eol; + $data .= $contents . $eol; + $data .= "--" . $boundary . "--" . $eol; + + $headers = array( + "Authorization: Bearer {$accessToken}", + "Content-Type: multipart/form-data; boundary={$boundary}" + ); + + $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.remove_from_lists_activity'); + $url = $this->buildUrl($baseUrl); + + $response = parent::getRestClient()->post($url, $headers, $data); + return Activity::create(json_decode($response->body, true)); + } } diff --git a/src/Ctct/Services/BaseService.php b/src/Ctct/Services/BaseService.php index c74c226..77fdc14 100755 --- a/src/Ctct/Services/BaseService.php +++ b/src/Ctct/Services/BaseService.php @@ -7,26 +7,27 @@ /** * Super class for all services * - * @package Services - * @author Constant Contact + * @package Services + * @author Constant Contact */ abstract class BaseService { /** * RestClient Implementation to use for HTTP requests - * @var $restClient - RestClient + * @var RestClientInterface */ - public $restClient; + protected $restClient; /** * ApiKey for the application * @var string */ protected $apiKey; - + /** * Constructor with the option to to supply an alternative rest client to be used - * @param RestClientInterface - RestClientInterface implementation to be used in the service + * @param string $apiKey - Constant Contact API Key + * @param RestClientInterface $restClient - RestClientInterface implementation to be used in the service */ public function __construct($apiKey, $restClient = null) { @@ -40,10 +41,13 @@ public function __construct($apiKey, $restClient = null) } /** - * Build a url from the base url and query parameters array + * Build a URL from a base url and optional array of query parameters to append to the url. URL query parameters + * should not be URL encoded and this method will handle that. + * @param $url + * @param array $queryParams * @return string */ - public function buildUrl($url, $queryParams = null) + public function buildUrl($url, array $queryParams = null) { $keyArr = array('api_key' => $this->apiKey); if ($queryParams) { @@ -51,10 +55,10 @@ public function buildUrl($url, $queryParams = null) } else { $params = $keyArr; } - - return $url . '?' . http_build_query($params); + + return $url . '?' . http_build_query($params, '', '&'); } - + /** * Get the rest client being used by the service * @return RestClientInterface - RestClientInterface implementation being used @@ -68,8 +72,8 @@ public function setRestClient(RestClientInterface $restClient) { $this->restClient = $restClient; } - - + + /** * Helper function to return required headers for making an http request with constant contact * @param $accessToken - OAuth2 access token to be placed into the Authorization header diff --git a/src/Ctct/Services/CampaignScheduleService.php b/src/Ctct/Services/CampaignScheduleService.php index 7f6424c..dd10c37 100755 --- a/src/Ctct/Services/CampaignScheduleService.php +++ b/src/Ctct/Services/CampaignScheduleService.php @@ -1,7 +1,6 @@ post($url, parent::getHeaders($accessToken), $schedule->toJson()); return Schedule::create(json_decode($response->body, true)); } - - /** + + /** * Get a list of schedules for a campaign * @param string $accessToken - Constant Contact OAuth2 access token * @param int $campaignId - Campaign id to be scheduled - * @return array + * @return array */ public function getSchedules($accessToken, $campaignId) { @@ -42,22 +41,22 @@ public function getSchedules($accessToken, $campaignId) sprintf(Config::get('endpoints.campaign_schedules'), $campaignId); $url = $this->buildUrl($baseUrl); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); - + $schedules = array(); - + foreach (json_decode($response->body, true) as $schedule) { $schedules[] = Schedule::create($schedule); } - + return $schedules; } - - /** + + /** * Get a specific schedule for a campaign * @param string $accessToken - Constant Contact OAuth2 access token * @param int $campaignId - Campaign id to be get a schedule for - * @param int $scheudle_id - Schedule id to retrieve - * @return Schedule + * @param int $scheduleId - Schedule id to retrieve + * @return Schedule */ public function getSchedule($accessToken, $campaignId, $scheduleId) { @@ -67,13 +66,13 @@ public function getSchedule($accessToken, $campaignId, $scheduleId) $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); return Schedule::create(json_decode($response->body, true)); } - + /** * Update a specific schedule for a campaign * @param string $accessToken - Constant Contact OAuth2 access token * @param int $campaignId - Campaign id to be scheduled - * @param Schedule $schedule - Schedule to retrieve - * @return Schedule + * @param Schedule $schedule - Schedule to retrieve + * @return Schedule */ public function updateSchedule($accessToken, $campaignId, Schedule $schedule) { @@ -83,13 +82,13 @@ public function updateSchedule($accessToken, $campaignId, Schedule $schedule) $response = parent::getRestClient()->put($url, parent::getHeaders($accessToken), $schedule->toJson()); return Schedule::create(json_decode($response->body, true)); } - - /** + + /** * Get a specific schedule for a campaign * @param string $accessToken - Constant Contact OAuth2 access token * @param int $campaignId - Campaign id * @param int $scheduleId - Schedule id to delete - * @return Schedule + * @return Schedule */ public function deleteSchedule($accessToken, $campaignId, $scheduleId) { diff --git a/src/Ctct/Services/CampaignTrackingService.php b/src/Ctct/Services/CampaignTrackingService.php index bfb974e..50c8b30 100755 --- a/src/Ctct/Services/CampaignTrackingService.php +++ b/src/Ctct/Services/CampaignTrackingService.php @@ -1,7 +1,6 @@ buildUrl($baseUrl, $params); - + $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); $body = json_decode($response->body, true); $bounces = array(); foreach ($body['results'] as $bounceActivity) { - $contacts[] = BounceActivity::create($bounceActivity); + $bounces[] = BounceActivity::create($bounceActivity); } - return new ResultSet($contacts, $body['meta']); + return new ResultSet($bounces, $body['meta']); } /** * Get clicks for a given campaign * @param string $accessToken - Constant Contact OAuth2 access token - * @param string $campaign_id - Campaign id - * @param array $param - query params to be appended to request - * @return TrackingActivity - Containing a results array of {@link ClickActivity} + * @param string $campaignId - Campaign id + * @param array $params - query params to be appended to request + * @return ResultSet - Containing a results array of {@link ClickActivity} */ - public function getClicks($accessToken, $campaign_id, Array $params = null) + public function getClicks($accessToken, $campaignId, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . - sprintf(Config::get('endpoints.campaign_tracking_clicks'), $campaign_id); + sprintf(Config::get('endpoints.campaign_tracking_clicks'), $campaignId); $url = $this->buildUrl($baseUrl, $params); @@ -73,14 +72,14 @@ public function getClicks($accessToken, $campaign_id, Array $params = null) /** * Get forwards for a given campaign * @param string $accessToken - Constant Contact OAuth2 access token - * @param string $campaign_id - Campaign id - * @param array $param - query param to be appended to request + * @param string $campaignId - Campaign id + * @param array $params - query param to be appended to request * @return ResultSet - Containing a results array of {@link ForwardActivity} */ - public function getForwards($accessToken, $campaign_id, Array $params = null) + public function getForwards($accessToken, $campaignId, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . - sprintf(Config::get('endpoints.campaign_tracking_forwards'), $campaign_id); + sprintf(Config::get('endpoints.campaign_tracking_forwards'), $campaignId); $url = $this->buildUrl($baseUrl, $params); @@ -101,7 +100,7 @@ public function getForwards($accessToken, $campaign_id, Array $params = null) * @param array $params - query params to be appended to request * @return ResultSet - Containing a results array of {@link OpenActivity} */ - public function getOpens($accessToken, $campaign_id, Array $params = null) + public function getOpens($accessToken, $campaign_id, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.campaign_tracking_opens'), $campaign_id); @@ -121,14 +120,14 @@ public function getOpens($accessToken, $campaign_id, Array $params = null) /** * Get sends for a given campaign * @param string $accessToken - Constant Contact OAuth2 access token - * @param string $campaign_id - Campaign id - * @param Array $param - query params to be appended to request + * @param string $campaignId - Campaign id + * @param Array $params - query params to be appended to request * @return TrackingActivity - Containing a results array of {@link SendActivity} */ - public function getSends($accessToken, $campaign_id, Array $params = null) + public function getSends($accessToken, $campaignId, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . - sprintf(Config::get('endpoints.campaign_tracking_sends'), $campaign_id); + sprintf(Config::get('endpoints.campaign_tracking_sends'), $campaignId); $url = $this->buildUrl($baseUrl, $params); @@ -145,14 +144,14 @@ public function getSends($accessToken, $campaign_id, Array $params = null) /** * Get unsubscribes for a given campaign * @param string $accessToken - Constant Contact OAuth2 access token - * @param string $campaign_id - Campaign id - * @param array $param - query params to be appended to request + * @param string $campaignId - Campaign id + * @param array $params - query params to be appended to request * @return ResultSet - Containing a results array of {@link UnsubscribeActivity} */ - public function getUnsubscribes($accessToken, $campaign_id, Array $params = null) + public function getUnsubscribes($accessToken, $campaignId, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . - sprintf(Config::get('endpoints.campaign_tracking_unsubscribes'), $campaign_id); + sprintf(Config::get('endpoints.campaign_tracking_unsubscribes'), $campaignId); $url = $this->buildUrl($baseUrl, $params); diff --git a/src/Ctct/Services/ContactService.php b/src/Ctct/Services/ContactService.php index 1180dc4..c7adf9f 100755 --- a/src/Ctct/Services/ContactService.php +++ b/src/Ctct/Services/ContactService.php @@ -2,15 +2,14 @@ namespace Ctct\Services; use Ctct\Util\Config; -use Ctct\Util\RestClient; use Ctct\Components\Contacts\Contact; use Ctct\Components\ResultSet; /** * Performs all actions pertaining to Constant Contact Contacts * - * @package Services - * @author Constant Contact + * @package Services + * @author ContactContact */ class ContactService extends BaseService { @@ -21,7 +20,7 @@ class ContactService extends BaseService * @param array $params - array of query parameters to be appended to the url * @return ResultSet */ - public function getContacts($accessToken, Array $params = null) + public function getContacts($accessToken, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.contacts'); $url = $this->buildUrl($baseUrl, $params); @@ -34,100 +33,90 @@ public function getContacts($accessToken, Array $params = null) } return new ResultSet($contacts, $body['meta']); } - + /** * Get contact details for a specific contact * @param string $accessToken - Constant Contact OAuth2 access token - * @param int $contact_id - Unique contact id + * @param int $contactId - Unique contact id * @return Contact */ - public function getContact($accessToken, $contact_id) + public function getContact($accessToken, $contactId) { - $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.contact'), $contact_id); + $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.contact'), $contactId); $url = $this->buildUrl($baseUrl); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); return Contact::create(json_decode($response->body, true)); } - + /** * Add a new contact to the Constant Contact account * @param string $accessToken - Constant Contact OAuth2 access token * @param Contact $contact - Contact to add - * @param boolean $actionByVisitor - is the action being taken by the visitor + * @param array $params - query params to be appended to the request * @return Contact */ - public function addContact($accessToken, Contact $contact, $actionByVisitor = false) + public function addContact($accessToken, Contact $contact, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.contacts'); - $params = array(); - - if ($actionByVisitor == true) { - $params['action_by'] = "ACTION_BY_VISITOR"; - } - $url = $this->buildUrl($baseUrl, $params); $response = parent::getRestClient()->post($url, parent::getHeaders($accessToken), $contact->toJson()); return Contact::create(json_decode($response->body, true)); } - + /** * Delete contact details for a specific contact * @param string $accessToken - Constant Contact OAuth2 access token - * @param int $contact_id - Unique contact id + * @param int $contactId - Unique contact id * @return boolean */ - public function deleteContact($accessToken, $contact_id) + public function deleteContact($accessToken, $contactId) { - $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.contact'), $contact_id); + $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.contact'), $contactId); $url = $this->buildUrl($baseUrl); $response = parent::getRestClient()->delete($url, parent::getHeaders($accessToken)); return ($response->info['http_code'] == 204) ? true : false; } - + /** * Delete a contact from all contact lists * @param string $accessToken - Constant Contact OAuth2 access token - * @param int $contact_id - Contact id to be removed from lists + * @param int $contactId - Contact id to be removed from lists * @return boolean */ - public function deleteContactFromLists($accessToken, $contact_id) + public function deleteContactFromLists($accessToken, $contactId) { - $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.contact_lists'), $contact_id); + $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.contact_lists'), $contactId); $url = $this->buildUrl($baseUrl); $response = parent::getRestClient()->delete($url, parent::getHeaders($accessToken)); return ($response->info['http_code'] == 204) ? true : false; } - + /** * Delete a contact from a specific contact list * @param string $accessToken - Constant Contact OAuth2 access token - * @param int $contact_id - Contact id to be removed - * @param int $list_id - ContactList to remove the contact from + * @param int $contactId - Contact id to be removed + * @param int $listId - ContactList to remove the contact from * @return boolean */ - public function deleteContactFromList($accessToken, $contact_id, $list_id) + public function deleteContactFromList($accessToken, $contactId, $listId) { $baseUrl = Config::get('endpoints.base_url') . - sprintf(Config::get('endpoints.contact_list'), $contact_id, $list_id); + sprintf(Config::get('endpoints.contact_list'), $contactId, $listId); $url = $this->buildUrl($baseUrl); $response = parent::getRestClient()->delete($url, parent::getHeaders($accessToken)); return ($response->info['http_code'] == 204) ? true : false; } - + /** * Update contact details for a specific contact * @param string $accessToken - Constant Contact OAuth2 access token * @param Contact $contact - Contact to be updated - * @param boolean $actionByVisitor - is the action being taken by the visitor + * @param array $params - query params to be appended to the request * @return Contact */ - public function updateContact($accessToken, Contact $contact, $actionByVisitor = false) + public function updateContact($accessToken, Contact $contact, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.contact'), $contact->id); - $params = array(); - if ($actionByVisitor == true) { - $params['action_by'] = "ACTION_BY_VISITOR"; - } $url = $this->buildUrl($baseUrl, $params); $response = parent::getRestClient()->put($url, parent::getHeaders($accessToken), $contact->toJson()); return Contact::create(json_decode($response->body, true)); diff --git a/src/Ctct/Services/ContactTrackingService.php b/src/Ctct/Services/ContactTrackingService.php index bbd6245..d5f27d8 100755 --- a/src/Ctct/Services/ContactTrackingService.php +++ b/src/Ctct/Services/ContactTrackingService.php @@ -1,10 +1,8 @@ buildUrl($baseUrl, $params); @@ -50,15 +48,15 @@ public function getBounces($accessToken, $contact_id, Array $params = null) /** * Get clicks for a given contact * @param string $accessToken - Constant Contact OAuth2 access token - * @param int $contact_id - Contact id - * @param array $param - query params to be appended to request + * @param int $contactId - Contact id + * @param array $params - query params to be appended to request * @return ResultSet - Containing a results array of {@link ClickActivity} */ - public function getClicks($accessToken, $contact_id, Array $params = null) + public function getClicks($accessToken, $contactId, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . - sprintf(Config::get('endpoints.contact_tracking_clicks'), $contact_id); - + sprintf(Config::get('endpoints.contact_tracking_clicks'), $contactId); + $url = $this->buildUrl($baseUrl, $params); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); @@ -75,15 +73,15 @@ public function getClicks($accessToken, $contact_id, Array $params = null) /** * Get forwards for a given contact * @param string $accessToken - Constant Contact OAuth2 access token - * @param int $contact_id - Contact id - * @param array $param - query params to be appended to request + * @param int $contactId - Contact id + * @param array $params - query params to be appended to request * @return ResultSet - Containing a results array of {@link ForwardActivity} */ - public function getForwards($accessToken, $contact_id, Array $params = null) + public function getForwards($accessToken, $contactId, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . - sprintf(Config::get('endpoints.contact_tracking_forwards'), $contact_id); - + sprintf(Config::get('endpoints.contact_tracking_forwards'), $contactId); + $url = $this->buildUrl($baseUrl, $params); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); @@ -99,15 +97,15 @@ public function getForwards($accessToken, $contact_id, Array $params = null) /** * Get opens for a given contact * @param string $accessToken - Constant Contact OAuth2 access token - * @param int $contact_id - Contact id - * @param array $param - query params to be appended to request + * @param int $contactId - Contact id + * @param array $params - query params to be appended to request * @return ResultSet - Containing a results array of {@link OpenActivity} */ - public function getOpens($accessToken, $contact_id, Array $params = null) + public function getOpens($accessToken, $contactId, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . - sprintf(Config::get('endpoints.contact_tracking_opens'), $contact_id); - + sprintf(Config::get('endpoints.contact_tracking_opens'), $contactId); + $url = $this->buildUrl($baseUrl, $params); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); @@ -125,14 +123,14 @@ public function getOpens($accessToken, $contact_id, Array $params = null) * @param string $accessToken - Constant Contact OAuth2 access token * @param string $accessToken - Constant Contact OAuth2 access token * @param int $contact_id - Contact id - * @param array $param - query params to be appended to request + * @param array $params - query params to be appended to request * @return ResultSet - Containing a results array of {@link SendActivity} */ - public function getSends($accessToken, $contact_id, Array $params = null) + public function getSends($accessToken, $contact_id, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.contact_tracking_sends'), $contact_id); - + $url = $this->buildUrl($baseUrl, $params); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); @@ -149,16 +147,16 @@ public function getSends($accessToken, $contact_id, Array $params = null) * Get unsubscribes for a given contact * @param string $accessToken - Constant Contact OAuth2 access token * @param int $contact_id - Contact id - * @param array $param - query params to be appended to request + * @param array $params - query params to be appended to request * @return ResultSet - Containing a results array of {@link UnsubscribeActivity} */ - public function getUnsubscribes($accessToken, $contact_id, Array $params = null) + public function getUnsubscribes($accessToken, $contact_id, array $params = array()) { $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.contact_tracking_unsubscribes'), $contact_id); $url = $this->buildUrl($baseUrl, $params); - + $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); $body = json_decode($response->body, true); $opt_outs = array(); diff --git a/src/Ctct/Services/EmailMarketingService.php b/src/Ctct/Services/EmailMarketingService.php index ae50386..82a20b9 100755 --- a/src/Ctct/Services/EmailMarketingService.php +++ b/src/Ctct/Services/EmailMarketingService.php @@ -1,7 +1,6 @@ post($url, parent::getHeaders($accessToken), $campaign->toJson()); return Campaign::create(json_decode($response->body, true)); } - + /** * Get a set of campaigns * @param string $accessToken - Constant Contact OAuth2 access token * @param array $params - query params to be appended to the request - * @return ResultSet + * @return ResultSet */ public function getCampaigns($accessToken, Array $params = null) { @@ -60,7 +59,7 @@ public function getCampaign($accessToken, $campaign_id) $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); return Campaign::create(json_decode($response->body, true)); } - + /** * Delete an email campaign * @param string $accessToken - Constant Contact OAuth2 access token @@ -74,7 +73,7 @@ public function deleteCampaign($accessToken, $campaign_id) $response = parent::getRestClient()->delete($url, parent::getHeaders($accessToken)); return ($response->info['http_code'] == 204) ? true : false; } - + /** * Update a specific email campaign * @param string $accessToken - Constant Contact OAuth2 access token diff --git a/src/Ctct/SplClassLoader.php b/src/Ctct/SplClassLoader.php index 58c5461..0c811c8 100644 --- a/src/Ctct/SplClassLoader.php +++ b/src/Ctct/SplClassLoader.php @@ -31,6 +31,7 @@ class SplClassLoader * specified namespace. * * @param string $ns The namespace to use. + * @param string $includePath The include path to use. */ public function __construct($ns = null, $includePath = null) { @@ -49,9 +50,9 @@ public function setNamespaceSeparator($sep) } /** - * Gets the namespace seperator used by classes in the namespace of this class loader. + * Gets the namespace separator used by classes in the namespace of this class loader. * - * @return void + * @return string $namespaceSeparator */ public function getNamespaceSeparator() { @@ -122,10 +123,10 @@ public function unregister() */ public function loadClass($className) { - if (null === $this->namespace || $this->namespace.$this->namespaceSeparator === - substr($className, 0, strlen($this->namespace.$this->namespaceSeparator))) { + if (null === $this->namespace || $this->namespace . $this->namespaceSeparator === + substr($className, 0, strlen($this->namespace . $this->namespaceSeparator)) + ) { $fileName = ''; - $namespace = ''; if (false !== ($lastNsPos = strripos($className, $this->namespaceSeparator))) { $namespace = substr($className, 0, $lastNsPos); $className = substr($className, $lastNsPos + 1); diff --git a/src/Ctct/Util/Config.php b/src/Ctct/Util/Config.php index 1ebfb66..79afa92 100755 --- a/src/Ctct/Util/Config.php +++ b/src/Ctct/Util/Config.php @@ -17,117 +17,104 @@ class Config /** * REST endpoints */ - 'endpoints' => array( - - 'base_url' => 'https://api.constantcontact.com/v2/', - - 'account_verified_addresses' => 'account/verifiedemailaddresses', + 'endpoints' => array( - 'activity' => 'activities/%s', - 'activities' => 'activities', - 'export_contacts_activity' => 'activities/exportcontacts', - 'clear_lists_activity' => 'activities/clearlists', - 'remove_from_lists_activity' => 'activities/removefromlists', - 'add_contacts_activity' => 'activities/addcontacts', + 'base_url' => 'https://api.constantcontact.com/v2/', + 'account_verified_addresses' => 'account/verifiedemailaddresses', + 'activity' => 'activities/%s', + 'activities' => 'activities', + 'export_contacts_activity' => 'activities/exportcontacts', + 'clear_lists_activity' => 'activities/clearlists', + 'remove_from_lists_activity' => 'activities/removefromlists', + 'add_contacts_activity' => 'activities/addcontacts', + 'contact' => 'contacts/%s', + 'contacts' => 'contacts', + 'lists' => 'lists', + 'list' => 'lists/%s', + 'list_contacts' => 'lists/%s/contacts', + 'contact_lists' => 'contacts/%s/lists', + 'contact_list' => 'contacts/%s/lists/%s', + 'campaigns' => 'emailmarketing/campaigns', + 'campaign' => 'emailmarketing/campaigns/%s', + 'campaign_schedules' => 'emailmarketing/campaigns/%s/schedules', + 'campaign_schedule' => 'emailmarketing/campaigns/%s/schedules/%s', + 'campaign_test_sends' => 'emailmarketing/campaigns/%s/tests', + 'campaign_tracking_summary' => 'emailmarketing/campaigns/%s/tracking/reports/summary', + 'campaign_tracking_bounces' => 'emailmarketing/campaigns/%s/tracking/bounces', + 'campaign_tracking_clicks' => 'emailmarketing/campaigns/%s/tracking/clicks', + 'campaign_tracking_forwards' => 'emailmarketing/campaigns/%s/tracking/forwards', + 'campaign_tracking_opens' => 'emailmarketing/campaigns/%s/tracking/opens', + 'campaign_tracking_sends' => 'emailmarketing/campaigns/%s/tracking/sends', + 'campaign_tracking_unsubscribes' => 'emailmarketing/campaigns/%s/tracking/unsubscribes', + 'campaign_tracking_link' => 'emailmarketing/campaigns/%s/tracking/clicks/%s', + 'contact_tracking_summary' => 'contacts/%s/tracking/reports/summary', + 'contact_tracking_bounces' => 'contacts/%s/tracking/bounces', + 'contact_tracking_clicks' => 'contacts/%s/tracking/clicks', + 'contact_tracking_forwards' => 'contacts/%s/tracking/forwards', + 'contact_tracking_opens' => 'contacts/%s/tracking/opens', + 'contact_tracking_sends' => 'contacts/%s/tracking/sends', + 'contact_tracking_unsubscribes' => 'contacts/%s/tracking/unsubscribes', + 'contact_tracking_link' => 'contacts/%s/tracking/clicks/%s' - 'contact' => 'contacts/%s', - 'contacts' => 'contacts', - - 'lists' => 'lists', - 'list' => 'lists/%s', - 'list_contacts' => 'lists/%s/contacts', - - 'contact_lists' => 'contacts/%s/lists', - 'contact_list' => 'contacts/%s/lists/%s', - - 'campaigns' => 'emailmarketing/campaigns', - 'campaign' => 'emailmarketing/campaigns/%s', - - 'campaign_schedules' => 'emailmarketing/campaigns/%s/schedules', - 'campaign_schedule' => 'emailmarketing/campaigns/%s/schedules/%s', - 'campaign_test_sends' => 'emailmarketing/campaigns/%s/tests', - - 'campaign_tracking_summary' => 'emailmarketing/campaigns/%s/tracking/reports/summary', - 'campaign_tracking_bounces' => 'emailmarketing/campaigns/%s/tracking/bounces', - 'campaign_tracking_clicks' => 'emailmarketing/campaigns/%s/tracking/clicks', - 'campaign_tracking_forwards' => 'emailmarketing/campaigns/%s/tracking/forwards', - 'campaign_tracking_opens' => 'emailmarketing/campaigns/%s/tracking/opens', - 'campaign_tracking_sends' => 'emailmarketing/campaigns/%s/tracking/sends', - 'campaign_tracking_unsubscribes' => 'emailmarketing/campaigns/%s/tracking/unsubscribes', - 'campaign_tracking_link' => 'emailmarketing/campaigns/%s/tracking/clicks/%s', - - 'contact_tracking_summary' => 'contacts/%s/tracking/reports/summary', - 'contact_tracking_bounces' => 'contacts/%s/tracking/bounces', - 'contact_tracking_clicks' => 'contacts/%s/tracking/clicks', - 'contact_tracking_forwards' => 'contacts/%s/tracking/forwards', - 'contact_tracking_opens' => 'contacts/%s/tracking/opens', - 'contact_tracking_sends' => 'contacts/%s/tracking/sends', - 'contact_tracking_unsubscribes' => 'contacts/%s/tracking/unsubscribes', - 'contact_tracking_link' => 'contacts/%s/tracking/clicks/%s' - ), - /** * Column names used with bulk activities */ 'activities_columns' => array( - 'email' => 'EMAIL', - 'first_name' => 'FIRST NAME', - 'middle_name' => 'MIDDLE NAME', - 'last_name' => 'LAST NAME', - 'job_title' => 'JOB TITLE', - 'company_name' => 'COMPANY NAME', - 'work_phone' => 'WORK PHONE', - 'home_phone' => 'HOME PHONE', - 'address1' => 'ADDRESS LINE 1', - 'address2' => 'ADDRESS LINE 2', - 'address3' => 'ADDRESS LINE 3', - 'city' => 'CITY', - 'state' => 'STATE', - 'state_province' => 'US STATE/CA PROVINCE', - 'country' => 'COUNTRY', - 'postal_code' => 'ZIP/POSTAL CODE', - 'sub_postal_code' => 'SUB ZIP/POSTAL CODE', - 'custom_field_1' => 'CUSTOM FIELD 1', - 'custom_field_2' => 'CUSTOM FIELD 2', - 'custom_field_3' => 'CUSTOM FIELD 3', - 'custom_field_4' => 'CUSTOM FIELD 4', - 'custom_field_5' => 'CUSTOM FIELD 5', - 'custom_field_6' => 'CUSTOM FIELD 6', - 'custom_field_7' => 'CUSTOM FIELD 7', - 'custom_field_8' => 'CUSTOM FIELD 8', - 'custom_field_9' => 'CUSTOM FIELD 9', - 'custom_field_10' => 'CUSTOM FIELD 10', - 'custom_field_11' => 'CUSTOM FIELD 11', - 'custom_field_12' => 'CUSTOM FIELD 12', - 'custom_field_13' => 'CUSTOM FIELD 13', - 'custom_field_14' => 'CUSTOM FIELD 14', - 'custom_field_15' => 'CUSTOM FIELD 15', + 'email' => 'EMAIL', + 'first_name' => 'FIRST NAME', + 'middle_name' => 'MIDDLE NAME', + 'last_name' => 'LAST NAME', + 'job_title' => 'JOB TITLE', + 'company_name' => 'COMPANY NAME', + 'work_phone' => 'WORK PHONE', + 'home_phone' => 'HOME PHONE', + 'address1' => 'ADDRESS LINE 1', + 'address2' => 'ADDRESS LINE 2', + 'address3' => 'ADDRESS LINE 3', + 'city' => 'CITY', + 'state' => 'STATE', + 'state_province' => 'US STATE/CA PROVINCE', + 'country' => 'COUNTRY', + 'postal_code' => 'ZIP/POSTAL CODE', + 'sub_postal_code' => 'SUB ZIP/POSTAL CODE', + 'custom_field_1' => 'CUSTOM FIELD 1', + 'custom_field_2' => 'CUSTOM FIELD 2', + 'custom_field_3' => 'CUSTOM FIELD 3', + 'custom_field_4' => 'CUSTOM FIELD 4', + 'custom_field_5' => 'CUSTOM FIELD 5', + 'custom_field_6' => 'CUSTOM FIELD 6', + 'custom_field_7' => 'CUSTOM FIELD 7', + 'custom_field_8' => 'CUSTOM FIELD 8', + 'custom_field_9' => 'CUSTOM FIELD 9', + 'custom_field_10' => 'CUSTOM FIELD 10', + 'custom_field_11' => 'CUSTOM FIELD 11', + 'custom_field_12' => 'CUSTOM FIELD 12', + 'custom_field_13' => 'CUSTOM FIELD 13', + 'custom_field_14' => 'CUSTOM FIELD 14', + 'custom_field_15' => 'CUSTOM FIELD 15', ), - /** * OAuth2 Authorization related configuration options */ - 'auth' => array( - 'base_url' => 'https://oauth2.constantcontact.com/oauth2/', - 'response_type_code' => 'code', - 'response_type_token' => 'token', + 'auth' => array( + 'base_url' => 'https://oauth2.constantcontact.com/oauth2/', + 'response_type_code' => 'code', + 'response_type_token' => 'token', 'authorization_code_grant_type' => 'authorization_code', - 'authorization_endpoint' => 'oauth/siteowner/authorize', - 'token_endpoint' => 'oauth/token', - 'token_info' => 'tokeninfo.htm' - + 'authorization_endpoint' => 'oauth/siteowner/authorize', + 'token_endpoint' => 'oauth/token', + 'token_info' => 'tokeninfo.htm' ), - /** * Errors to be returned for various exceptions */ - 'errors' => array( - 'id_or_object' => 'Only an id or %s object are allowed for this method.' + 'errors' => array( + 'id_or_object' => 'Only an id or %s object are allowed for this method.' ) - + ); - + /** * Get a configuration property given a specified location, example usage: Config::get('auth.token_endpoint') * @param $index - location of the property to obtain @@ -138,7 +125,7 @@ public static function get($index) $index = explode('.', $index); return self::getValue($index, self::$props); } - + /** * Navigate through a config array looking for a particular index * @param array $index The index sequence we are navigating down diff --git a/src/Ctct/Util/CurlResponse.php b/src/Ctct/Util/CurlResponse.php index a1c5422..76facf7 100755 --- a/src/Ctct/Util/CurlResponse.php +++ b/src/Ctct/Util/CurlResponse.php @@ -6,23 +6,23 @@ * A CurlResponse object to be returned from a RestClientInterface implementation * * @package Util - * @author Constant Contact + * @author Constant Contact */ class CurlResponse { - + public $body; public $error; public $info; - + public static function create($body, $info, $error = null) { $curl = new CurlResponse(); - + $curl->body = $body; $curl->info = $info; $curl->error = $error; - + return $curl; } } diff --git a/src/Ctct/Util/RestClient.php b/src/Ctct/Util/RestClient.php index 8e13c68..150fe97 100755 --- a/src/Ctct/Util/RestClient.php +++ b/src/Ctct/Util/RestClient.php @@ -1,15 +1,13 @@ body, true); if (isset($body[0]) && array_key_exists('error_key', $body[0])) { @@ -95,7 +93,7 @@ private static function httpRequest($url, $method, array $headers = array(), $da $ex->setErrors($body); throw $ex; } - + return $response; } } diff --git a/src/Ctct/Util/RestClientInterface.php b/src/Ctct/Util/RestClientInterface.php index ca95275..5c1cc72 100755 --- a/src/Ctct/Util/RestClientInterface.php +++ b/src/Ctct/Util/RestClientInterface.php @@ -14,34 +14,33 @@ interface RestClientInterface * Make an Http GET request * @param $url - request url * @param array $headers - array of all http headers to send - * @return array - array of the response body, http info, and error (if one exists) + * @return CurlResponse - The response body, http info, and error (if one exists) */ public function get($url, array $headers); - + /** * Make an Http POST request * @param $url - request url * @param array $headers - array of all http headers to send * @param $data - data to send with request - * @return array - array of the response body, http info, and error (if one exists) + * @return CurlResponse - The response body, http info, and error (if one exists) */ public function post($url, array $headers = array(), $data = null); - + /** * Make an Http PUT request * @param $url - request url * @param array $headers - array of all http headers to send * @param $data - data to send with request - * @return array - array of the response body, http info, and error (if one exists) + * @return CurlResponse - The response body, http info, and error (if one exists) */ public function put($url, array $headers = array(), $data = null); - + /** * Make an Http DELETE request * @param $url - request url * @param array $headers - array of all http headers to send - * @param $data - data to send with request - * @return array - array of the response body, http info, and error (if one exists) + * @return CurlResponse - The response body, http info, and error (if one exists) */ public function delete($url, array $headers = array()); } diff --git a/src/Ctct/WebHooks/CTCTWebhookUtil.php b/src/Ctct/WebHooks/CTCTWebhookUtil.php index bf71ace..b17a363 100644 --- a/src/Ctct/WebHooks/CTCTWebhookUtil.php +++ b/src/Ctct/WebHooks/CTCTWebhookUtil.php @@ -55,13 +55,17 @@ public function setClientSecret($clientSecret) } /** - * @param $xCtctHmacSHA256 - The value in the x-ctct-hmac-sha256 header. - * @param $bodyMessage - The body message from the POST received from ConstantContact in Webhook callback. - * @return object corresponding to bodyMessage in case of success; an exception is thrown otherwise. - * @throws CtctException Thrown when: + * Get Billing Change Notification.
+ * + * Validates and parses the bodyMessage into + * + * @param xCtctHmacSHA256 The value in the x-ctct-hmac-sha256 header. + * @param bodyMessage The body message from the POST received from ConstantContact in Webhook callback. + * @return The object corresponding to bodyMessage in case of success; an exception is thrown otherwise. + * @throws CtctException Thrown when : *
    - *
  • message encryption does not correspond with x-ctct-hmac-sha256 header value
  • - *
  • or an error is raised when parsing the bodyMessage
  • + *
  • message encryption does not correspond with x-ctct-hmac-sha256 header value;
  • + *
  • or an error is raised when parsing the bodyMessage.
  • *
*

*/ @@ -77,10 +81,12 @@ public function getBillingChangeNotification($xCtctHmacSHA256, $bodyMessage) } /** - * @param $xCtctHmacSHA256 - The value in the x-ctct-hmac-sha256 header. - * @param $bodyMessage - The body message from the POST received from ConstantContact in Webhook callback. - * @return bool - * @throws CtctException + * Check if a Webhook message is valid or not.
+ * + * @param xCtctHmacSHA256 The value in the x-ctct-hmac-sha256 header. + * @param bodyMessage The body message from the POST received from ConstantContact in Webhook callback. + * @return true if in case of success; false if the Webhook is invalid. + * */ public function isValidWebhook($xCtctHmacSHA256, $bodyMessage) { diff --git a/test/Auth/CtctOAuth2UnitTest.php b/test/Auth/CtctOAuth2UnitTest.php index 3068933..6fc6932 100644 --- a/test/Auth/CtctOAuth2UnitTest.php +++ b/test/Auth/CtctOAuth2UnitTest.php @@ -9,11 +9,14 @@ class CtctOAuth2UnitTest extends PHPUnit_Framework_TestCase private $restClient; private $ctctOAuth2; + private $apiKey = "apiKey"; + private $clientSecret = "clientSecret"; + private $redirectUri = "redirectUri"; public function setUp() { $this->restClient = $this->getMock('Ctct\Util\RestClientInterface'); - $this->ctctOAuth2 = new CtctOAuth2("apiKey", "clientSecret", "redirectUri", $this->restClient); + $this->ctctOAuth2 = new CtctOAuth2($this->apiKey, $this->clientSecret, $this->redirectUri, $this->restClient); } public function testGetTokenInfo() @@ -54,6 +57,62 @@ public function testGetAuthorizationUrl($server, $expectedResponse) $this->assertEquals($expectedResponse, $this->ctctOAuth2->getAuthorizationUrl($server)); } + public function testGetAuthorizationUrlServer() + { + $authUrl = $this->ctctOAuth2->getAuthorizationUrl(); + $baseUrl = Config::get('auth.base_url') . Config::get('auth.authorization_endpoint'); + $params = array( + 'response_type' => 'code', + 'client_id' => $this->apiKey, + 'redirect_uri' => $this->redirectUri + ); + $expectedUrl = $baseUrl . '?' . http_build_query($params); + $this->assertEquals($expectedUrl, $authUrl); + } + + public function testGetAuthorizationUrlClient() + { + $authUrl = $this->ctctOAuth2->getAuthorizationUrl(false); + $baseUrl = Config::get('auth.base_url') . Config::get('auth.authorization_endpoint'); + $params = array( + 'response_type' => 'token', + 'client_id' => $this->apiKey, + 'redirect_uri' => $this->redirectUri + ); + $expectedUrl = $baseUrl . '?' . http_build_query($params); + $this->assertEquals($expectedUrl, $authUrl); + } + + public function testGetAuthorizationUrlServerWithState() + { + $state = 'this is my state'; + $authUrl = $this->ctctOAuth2->getAuthorizationUrl(true, $state); + $baseUrl = Config::get('auth.base_url') . Config::get('auth.authorization_endpoint'); + $params = array( + 'response_type' => 'code', + 'client_id' => $this->apiKey, + 'redirect_uri' => $this->redirectUri, + 'state' => $state + ); + $expectedUrl = $baseUrl . '?' . http_build_query($params); + $this->assertEquals($expectedUrl, $authUrl); + } + + public function testGetAuthorizationUrlClientWithState() + { + $state = 'this is my state'; + $authUrl = $this->ctctOAuth2->getAuthorizationUrl(false, $state); + $baseUrl = Config::get('auth.base_url') . Config::get('auth.authorization_endpoint'); + $params = array( + 'response_type' => 'token', + 'client_id' => $this->apiKey, + 'redirect_uri' => $this->redirectUri, + 'state' => $state + ); + $expectedUrl = $baseUrl . '?' . http_build_query($params); + $this->assertEquals($expectedUrl, $authUrl); + } + public function authorizationUrlProvider() { $requestParams = "&client_id=apiKey&redirect_uri=redirectUri"; diff --git a/test/Json/Activities/add_contacts.txt b/test/Json/Activities/add_contacts.txt new file mode 100644 index 0000000..e7f71b0 --- /dev/null +++ b/test/Json/Activities/add_contacts.txt @@ -0,0 +1,3 @@ +EMAIL FIRST NAME +john.doe@constantcontact.com John +jane.doe@constantcontact.com Jane \ No newline at end of file diff --git a/test/Json/Activities/remove_contacts.txt b/test/Json/Activities/remove_contacts.txt new file mode 100644 index 0000000..15b126a --- /dev/null +++ b/test/Json/Activities/remove_contacts.txt @@ -0,0 +1 @@ +djellesma@constantcontact.com \ No newline at end of file diff --git a/test/Json/Auth/get_access_token.json b/test/Json/Auth/get_access_token.json index 2a7e3eb..c80bc18 100644 --- a/test/Json/Auth/get_access_token.json +++ b/test/Json/Auth/get_access_token.json @@ -1,5 +1,5 @@ - { +{ "access_token": "v6574b42-a5bc-4574-a87f-5c9d1202e316", "expires_in": "308874923", "token_type": "Bearer" - } \ No newline at end of file +} \ No newline at end of file diff --git a/test/Json/Campaigns/get_campaign.json b/test/Json/Campaigns/get_campaign.json index fba6367..c6ea320 100755 --- a/test/Json/Campaigns/get_campaign.json +++ b/test/Json/Campaigns/get_campaign.json @@ -12,6 +12,7 @@ "last_run_date": "2012-12-06T18:06:40.342Z", "is_permission_reminder_enabled": false, "permission_reminder_text": "", + "permalink_url": "http://www.constantcontact.com", "is_view_as_webpage_enabled": false, "view_as_web_page_text": "Having trouble viewing this email?", "view_as_web_page_link_text": "Click Here", @@ -43,7 +44,8 @@ "clicks": 10, "forwards": 3, "unsubscribes": 2, - "bounces": 18 + "bounces": 18, + "spam_count": 1 }, "archive_status": "PENDING", "archive_url": "http://archive.l1.constantcontact.com/fs136/1100394124185/archive/1100394165290.html", diff --git a/test/Json/Campaigns/get_campaigns_modified_since1.json b/test/Json/Campaigns/get_campaigns_modified_since1.json new file mode 100644 index 0000000..80a87b7 --- /dev/null +++ b/test/Json/Campaigns/get_campaigns_modified_since1.json @@ -0,0 +1,21 @@ +{ + "meta": { + "pagination": { + "next_link": "/v2/emailmarketing/campaigns?next=ABcGFnZU51bT0yJnBhZ2VTaXplPTImbW9kaWZpZWRfc2luY2U9MTM1OTUxNjYzMDU5MA" + } + }, + "results": [ + { + "id": "9112921497760", + "name": "Email Created 2013/03/29, 11:30 PM", + "status": "DRAFT", + "modified_date": "2013-03-30T03:30:48.033Z" + }, + { + "id": "9112756952331", + "name": "CampaignName234", + "status": "DRAFT", + "modified_date": "2013-03-14T15:00:07.883Z" + } + ] +} \ No newline at end of file diff --git a/test/Json/Campaigns/get_campaigns_modified_since2.json b/test/Json/Campaigns/get_campaigns_modified_since2.json new file mode 100644 index 0000000..01455dc --- /dev/null +++ b/test/Json/Campaigns/get_campaigns_modified_since2.json @@ -0,0 +1,21 @@ +{ + "meta": { + "pagination": { + "next_link": "/v2/emailmarketing/campaigns?next=ABcGFnZU51bT0zJnBhZ2VTaXplPTImbW9kaWZpZWRfc2luY2U9MTM1OTUxNjYzMDU5MA" + } + }, + "results": [ + { + "id": "9112449567999", + "name": "Copy of running deal", + "status": "DRAFT", + "modified_date": "2013-02-12T20:04:59.436Z" + }, + { + "id": "9111772694630", + "name": "aaapi test campaign3", + "status": "SENT", + "modified_date": "2013-02-01T18:30:06.294Z" + } + ] +} \ No newline at end of file diff --git a/test/Json/Campaigns/get_schedules.json b/test/Json/Campaigns/get_schedules.json index 9afaed4..b6cfccb 100755 --- a/test/Json/Campaigns/get_schedules.json +++ b/test/Json/Campaigns/get_schedules.json @@ -1,9 +1,9 @@ [ - { + { "id": 1, "scheduled_date": "2012-12-16T11:07:43.626Z" - }, - { + }, + { "id": 2, "scheduled_date": "2012-12-17T11:08:00.000Z" } diff --git a/test/Json/Contacts/get_contact.json b/test/Json/Contacts/get_contact.json index 0c5204c..d5fcf1a 100755 --- a/test/Json/Contacts/get_contact.json +++ b/test/Json/Contacts/get_contact.json @@ -16,7 +16,7 @@ } ], "notes": [ - { + { "id": 1, "note": "Here are some cool notes to add", "created_date": "2012-12-03T17:09:22.702Z" diff --git a/test/Json/Contacts/get_contacts.json b/test/Json/Contacts/get_contacts.json index 78721b9..d0a1988 100755 --- a/test/Json/Contacts/get_contacts.json +++ b/test/Json/Contacts/get_contacts.json @@ -4,7 +4,7 @@ "next_link": "/v2/contacts?next=c3RhcnRBdD0zJmxpbWl0PTI" } }, - "results": [ + "results": [ { "id": 230, "status": "REMOVED", diff --git a/test/Json/Contacts/get_contacts_modified_since.json b/test/Json/Contacts/get_contacts_modified_since.json new file mode 100644 index 0000000..e263704 --- /dev/null +++ b/test/Json/Contacts/get_contacts_modified_since.json @@ -0,0 +1,110 @@ +{ + "meta": { + "pagination": { + "next_link": "/v2/contacts?next=c3RhcnRBdD0yMjQmbGltaXQ9Mg" + } + }, + "results": [ + { + "id": "1", + "status": "REMOVED", + "fax": "", + "addresses": [ + { + "id": "2", + "line1": "", + "line2": "", + "line3": "", + "city": "", + "address_type": "PERSONAL", + "state_code": "", + "country_code": "", + "postal_code": "", + "sub_postal_code": "" + }, + { + "id": "3", + "line1": "", + "line2": "", + "line3": "", + "city": "", + "address_type": "BUSINESS", + "state_code": "", + "country_code": "", + "postal_code": "", + "sub_postal_code": "" + } + ], + "notes": [], + "confirmed": false, + "lists": [], + "source": "", + "email_addresses": [ + { + "id": "1", + "status": "REMOVED", + "confirm_status": "NO_CONFIRMATION_REQUIRED", + "opt_in_source": "ACTION_BY_OWNER", + "opt_in_date": "2012-02-09T23:27:35.517Z", + "email_address": "testaddress@example.com" + } + ], + "prefix_name": "", + "first_name": "John", + "middle_name": "", + "last_name": "Doe", + "job_title": "", + "company_name": "", + "home_phone": "", + "work_phone": "", + "cell_phone": "", + "custom_fields": [ + { + "name": "CustomField1", + "value": "adfasdfasdf" + } + ], + "created_date": "2012-01-02T15:26:11.214Z", + "modified_date": "2013-05-01T15:21:13.000Z", + "source_details": "" + }, + { + "id": "6", + "status": "ACTIVE", + "fax": "", + "addresses": [], + "notes": [], + "confirmed": false, + "lists": [ + { + "id": "18", + "status": "ACTIVE" + } + ], + "source": "", + "email_addresses": [ + { + "id": "1", + "status": "ACTIVE", + "confirm_status": "NO_CONFIRMATION_REQUIRED", + "opt_in_source": "ACTION_BY_OWNER", + "opt_in_date": "2012-02-12T16:25:15.089Z", + "email_address": "testaddress2@example.com" + } + ], + "prefix_name": "", + "first_name": "", + "middle_name": "", + "last_name": "", + "job_title": "", + "company_name": "", + "home_phone": "", + "work_phone": "", + "cell_phone": "", + "custom_fields": [], + "created_date": "2012-02-05T20:59:24.553Z", + "modified_date": "2013-02-01T18:07:50.350Z", + "source_details": "" + } + ] +} \ No newline at end of file diff --git a/test/Json/Contacts/get_contacts_no_next.json b/test/Json/Contacts/get_contacts_no_next.json index 6ed6fad..71fd55e 100644 --- a/test/Json/Contacts/get_contacts_no_next.json +++ b/test/Json/Contacts/get_contacts_no_next.json @@ -2,7 +2,7 @@ "meta": { "pagination": {} }, - "results": [ + "results": [ { "id": 230, "status": "REMOVED", diff --git a/test/Json/JsonLoader.php b/test/Json/JsonLoader.php index 60f579c..ce8dd12 100755 --- a/test/Json/JsonLoader.php +++ b/test/Json/JsonLoader.php @@ -2,7 +2,7 @@ class JsonLoader { - + const CONTACTS_FOLDER = "/Contacts"; const LISTS_FOLDER = "/Lists"; const CAMPAIGNS_FOLDER = "/Campaigns"; @@ -11,6 +11,16 @@ class JsonLoader const ACCCOUNT_FOLDER = "/Account"; const AUTH_FOLDER = "/Auth"; + public static function getContactsTextContents() + { + return file_get_contents(__DIR__. self::ACTIVITES_FOLDER . "/add_contacts.txt"); + } + + public static function getRemoveContactsTextContents() + { + return file_get_contents(__DIR__. self::ACTIVITES_FOLDER . "/remove_contacts.txt"); + } + public static function getTokenInfoJson() { return file_get_contents(__DIR__ . self::AUTH_FOLDER . "/token_info.json"); @@ -25,37 +35,47 @@ public static function getVerifiedAddressesJson() { return file_get_contents(__DIR__ . self::ACCCOUNT_FOLDER . "/get_verified_email_addresses.json"); } - + public static function getContactJson() { return file_get_contents(__DIR__ . self::CONTACTS_FOLDER . "/get_contact.json"); } - + public static function getContactsJson() { return file_get_contents(__DIR__ . self::CONTACTS_FOLDER . "/get_contacts.json"); } + public static function getContactsModifiedSinceJson() + { + return file_get_contents(__DIR__ . self::CONTACTS_FOLDER . "/get_contacts_modified_since.json"); + } + public static function getContactsNoNextJson() { return file_get_contents(__DIR__ . self::CONTACTS_FOLDER . "/get_contacts_no_next.json"); } - + public static function getListsJson() { return file_get_contents(__DIR__ . self::LISTS_FOLDER . "/get_lists.json"); } - + public static function getListJson() { return file_get_contents(__DIR__ . self::LISTS_FOLDER . "/get_list.json"); } - + public static function getCampaignJson() { return file_get_contents(__DIR__ . self::CAMPAIGNS_FOLDER . "/get_campaign.json"); } - + + public static function getCampaignModifiedSinceJson($page = 1) + { + return file_get_contents(__DIR__ . self::CAMPAIGNS_FOLDER . "/get_campaigns_modified_since{$page}.json"); + } + public static function getCampaignsJson() { return file_get_contents(__DIR__ . self::CAMPAIGNS_FOLDER . "/get_campaigns.json"); diff --git a/test/Services/ActivityServiceUnitTest.php b/test/Services/ActivityServiceUnitTest.php index 7413545..afc8a7c 100644 --- a/test/Services/ActivityServiceUnitTest.php +++ b/test/Services/ActivityServiceUnitTest.php @@ -11,7 +11,7 @@ class ActivityServiceUnitTest extends PHPUnit_Framework_TestCase { - + private $restClient; private $activityService; @@ -64,6 +64,27 @@ public function testGetActivities() $this->assertEquals(0, $activity->contact_count); } + public function testGetActivitiesWithType() + { + $curlResponse = CurlResponse::create(JsonLoader::getActivities(), array('http_code' => 200)); + $this->restClient->expects($this->once()) + ->method('get') + ->with() + ->will($this->returnValue($curlResponse)); + + $activities = $this->activityService->getActivities('access_token', array('type' => 'EXPORT_CONTACTS')); + $activity = $activities[0]; + $this->assertInstanceOf('Ctct\Components\Activities\Activity', $activity); + $this->assertEquals("a07e1ikxwuphd4nwjxl", $activity->id); + $this->assertEquals("EXPORT_CONTACTS", $activity->type); + $this->assertEquals("COMPLETE", $activity->status); + $this->assertEquals("2013-02-13T15:57:03.627Z", $activity->start_date); + $this->assertEquals("2013-02-13T15:57:03.649Z", $activity->finish_date); + $this->assertEquals("2013-02-13T15:56:14.697Z", $activity->created_date); + $this->assertEquals(0, $activity->error_count); + $this->assertEquals(0, $activity->contact_count); + } + public function testAddClearListsActivity() { $curlResponse = CurlResponse::create(JsonLoader::getClearListsActivity(), array('http_code' => 201)); @@ -72,7 +93,7 @@ public function testAddClearListsActivity() ->with() ->will($this->returnValue($curlResponse)); - $activity = $this->activityService->addClearListsActivity("access_token", array("1","2")); + $activity = $this->activityService->addClearListsActivity("access_token", array("1", "2")); $this->assertInstanceOf('Ctct\Components\Activities\Activity', $activity); $this->assertEquals("a07e1il69fwhd7uan9h", $activity->id); $this->assertEquals("CLEAR_CONTACTS_FROM_LISTS", $activity->type); @@ -119,6 +140,33 @@ public function testAddRemoveContactsFromListsActivity() $this->assertEquals(0, $activity->contact_count); } + public function testAddRemoveContactsFromListsActivityFromFile() + { + $curlResponse = CurlResponse::create( + JsonLoader::getRemoveContactsFromListsActivity(), + array('http_code' => 201) + ); + + $this->restClient->expects($this->once()) + ->method('post') + ->with() + ->will($this->returnValue($curlResponse)); + + $activity = $this->activityService->addRemoveContactsFromListsActivityFromFile( + 'access_token', + 'contacts.txt', + JsonLoader::getRemoveContactsTextContents(), + '7' + ); + + + $this->assertInstanceOf('Ctct\Components\Activities\Activity', $activity); + $this->assertEquals("a07e1i5nqamhcfeuu0h", $activity->id); + $this->assertEquals("REMOVE_CONTACTS_FROM_LISTS", $activity->type); + $this->assertEquals(0, $activity->error_count); + $this->assertEquals(0, $activity->contact_count); + } + public function testAddCreateContactsActivity() { $curlResponse = CurlResponse::create(JsonLoader::getAddContactsActivity(), array('http_code' => 201)); @@ -154,4 +202,27 @@ public function testAddCreateContactsActivity() $this->assertEquals(0, $activity->error_count); $this->assertEquals(1, $activity->contact_count); } + + public function testAddCreateContactsActivityFromFile() + { + + $curlResponse = CurlResponse::create(JsonLoader::getAddContactsActivity(), array('http_code' => 201)); + $this->restClient->expects($this->once()) + ->method('post') + ->with() + ->will($this->returnValue($curlResponse)); + + $activity = $this->activityService->createAddContactsActivityFromFile( + "access_token", + 'contacts.txt', + JsonLoader::getContactsTextContents(), + '7' + ); + + $this->assertInstanceOf('Ctct\Components\Activities\Activity', $activity); + $this->assertEquals("a07e1il69qzhdby44ro", $activity->id); + $this->assertEquals("ADD_CONTACTS", $activity->type); + $this->assertEquals(0, $activity->error_count); + $this->assertEquals(1, $activity->contact_count); + } } diff --git a/test/Services/CampaignScheduleServiceUnitTest.php b/test/Services/CampaignScheduleServiceUnitTest.php index ce7ac21..4a288e3 100755 --- a/test/Services/CampaignScheduleServiceUnitTest.php +++ b/test/Services/CampaignScheduleServiceUnitTest.php @@ -8,7 +8,7 @@ class CampaignScheduleServiceUnitTest extends PHPUnit_Framework_TestCase { - + private $restClient; private $campaignScheduleService; @@ -70,7 +70,7 @@ public function testUpdateSchedule() ->method('put') ->with() ->will($this->returnValue($curlResponse)); - + $updatedSchedule = $this->campaignScheduleService->updateSchedule( 'access_token', "9100367935463", diff --git a/test/Services/CampaignTrackingServiceUnitTest.php b/test/Services/CampaignTrackingServiceUnitTest.php index 7decee8..cfd601a 100755 --- a/test/Services/CampaignTrackingServiceUnitTest.php +++ b/test/Services/CampaignTrackingServiceUnitTest.php @@ -28,7 +28,7 @@ public function testGetBounces() $this->assertInstanceOf('Ctct\Components\ResultSet', $resultSet); $this->assertInstanceOf('Ctct\Components\Tracking\BounceActivity', $resultSet->results[0]); - $this->assertEquals("?next=bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); + $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_BOUNCE", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("2", $resultSet->results[0]->contact_id); @@ -55,7 +55,7 @@ public function testGetClicks() $this->assertInstanceOf('Ctct\Components\ResultSet', $resultSet); $this->assertInstanceOf('Ctct\Components\Tracking\ClickActivity', $resultSet->results[0]); - $this->assertEquals("?next=bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); + $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_CLICK", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("69", $resultSet->results[0]->contact_id); @@ -80,7 +80,7 @@ public function testGetForwards() $this->assertInstanceOf('Ctct\Components\ResultSet', $resultSet); $this->assertInstanceOf('Ctct\Components\Tracking\ForwardActivity', $resultSet->results[0]); - $this->assertEquals("?next=bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); + $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_FORWARD", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("74", $resultSet->results[0]->contact_id); @@ -108,7 +108,7 @@ public function testGetUnsubscribes() $this->assertInstanceOf('Ctct\Components\ResultSet', $resultSet); $this->assertInstanceOf('Ctct\Components\Tracking\UnsubscribeActivity', $resultSet->results[0]); - $this->assertEquals("?next=bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); + $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_UNSUBSCRIBE", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("58", $resultSet->results[0]->contact_id); @@ -134,7 +134,7 @@ public function testGetSends() $this->assertInstanceOf('Ctct\Components\ResultSet', $resultSet); $this->assertInstanceOf('Ctct\Components\Tracking\SendActivity', $resultSet->results[0]); - $this->assertEquals("?next=bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); + $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_SEND", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("55", $resultSet->results[0]->contact_id); @@ -158,7 +158,7 @@ public function testGetOpens() $this->assertInstanceOf('Ctct\Components\ResultSet', $resultSet); $this->assertInstanceOf('Ctct\Components\Tracking\OpenActivity', $resultSet->results[0]); - $this->assertEquals("?next=bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); + $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_OPEN", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("86", $resultSet->results[0]->contact_id); @@ -179,7 +179,7 @@ public function testGetSummary() ->will($this->returnValue($curlResponse)); $summary = $this->campaignTrackingService->getSummary('access_token', 1100394165290); - + $this->assertInstanceOf('Ctct\Components\Tracking\TrackingSummary', $summary); $this->assertEquals(15, $summary->sends); $this->assertEquals(10, $summary->opens); diff --git a/test/Services/ContactServiceUnitTest.php b/test/Services/ContactServiceUnitTest.php index bab40ea..4ae56d8 100755 --- a/test/Services/ContactServiceUnitTest.php +++ b/test/Services/ContactServiceUnitTest.php @@ -4,10 +4,9 @@ use Ctct\Util\RestClient; use Ctct\Components\Contacts\Contact; use Ctct\Util\CurlResponse; - + class ContactServiceUnitTest extends PHPUnit_Framework_TestCase { - private $restClient; private $contactService; @@ -28,7 +27,7 @@ public function testGetContacts() $response = $this->contactService->getContacts('access_token', array('limit' => 2)); $this->assertInstanceOf("Ctct\Components\ResultSet", $response); - $this->assertEquals('?next=c3RhcnRBdD0zJmxpbWl0PTI', $response->next); + $this->assertEquals('c3RhcnRBdD0zJmxpbWl0PTI', $response->next); $contact = $response->results[1]; $this->assertInstanceOf("Ctct\Components\Contacts\Contact", $contact); @@ -44,12 +43,12 @@ public function testGetContacts() $this->assertEquals("details", $contact->source_details); $this->assertEquals(false, $contact->confirmed); $this->assertEquals("", $contact->source); - + // custom fields $this->assertEquals("CustomField1", $contact->custom_fields[0]->name); $this->assertInstanceOf("Ctct\Components\Contacts\CustomField", $contact->custom_fields[0]); $this->assertEquals("1", $contact->custom_fields[0]->value); - + //addresses $this->assertEquals("Suite 101", $contact->addresses[0]->line1); $this->assertEquals("line2", $contact->addresses[0]->line2); @@ -60,10 +59,10 @@ public function testGetContacts() $this->assertEquals("us", $contact->addresses[0]->country_code); $this->assertEquals("53027", $contact->addresses[0]->postal_code); $this->assertEquals("", $contact->addresses[0]->sub_postal_code); - + //notes $this->assertEquals(0, count($contact->notes)); - + //lists $this->assertEquals(1, $contact->lists[0]->id); $this->assertEquals("ACTIVE", $contact->lists[0]->status); @@ -78,6 +77,30 @@ public function testGetContacts() $this->assertEquals("anothertest@roving.com", $contact->email_addresses[0]->email_address); } + public function testGetContactsModifiedSince() + { + $curlResponse = CurlResponse::create( + JsonLoader::getContactsModifiedSinceJson(), + array('modified_since' => '2013-01-12T20:04:59.436Z', 'limit' => 2) + ); + $this->restClient->expects($this->once()) + ->method('get') + ->with() + ->will($this->returnValue($curlResponse)); + + $response = $this->contactService->getContacts('access_token', array('limit' => 2)); + $this->assertInstanceOf("Ctct\Components\ResultSet", $response); + $contact = $response->results[0]; + + $this->assertEquals('c3RhcnRBdD0yMjQmbGltaXQ9Mg', $response->next); + $this->assertEquals('1', $contact->id); + $this->assertEquals('John', $contact->first_name); + $this->assertEquals('Doe', $contact->last_name); + + $this->assertEquals('6', $response->results[1]->id); + $this->assertEquals('ACTIVE', $response->results[1]->status); + } + public function testGetContactsNoNextLink() { $curlResponse = CurlResponse::create(JsonLoader::getContactsNoNextJson(), array('http_code' => 200)); @@ -89,7 +112,7 @@ public function testGetContactsNoNextLink() $response = $this->contactService->getContacts('access_token', array('limit' => 2)); $this->assertInstanceOf("Ctct\Components\ResultSet", $response); $contact = $response->results[1]; - + $this->assertInstanceOf("Ctct\Components\Contacts\Contact", $contact); $this->assertEquals($response->next, null); $this->assertEquals(231, $contact->id); @@ -104,12 +127,12 @@ public function testGetContactsNoNextLink() $this->assertEquals("details", $contact->source_details); $this->assertEquals(false, $contact->confirmed); $this->assertEquals("", $contact->source); - + // custom fields $this->assertInstanceOf("Ctct\Components\Contacts\CustomField", $contact->custom_fields[0]); $this->assertEquals("CustomField1", $contact->custom_fields[0]->name); $this->assertEquals("1", $contact->custom_fields[0]->value); - + //addresses $this->assertInstanceOf("Ctct\Components\Contacts\Address", $contact->addresses[0]); $this->assertEquals("Suite 101", $contact->addresses[0]->line1); @@ -121,10 +144,10 @@ public function testGetContactsNoNextLink() $this->assertEquals("us", $contact->addresses[0]->country_code); $this->assertEquals("53027", $contact->addresses[0]->postal_code); $this->assertEquals("", $contact->addresses[0]->sub_postal_code); - + //notes $this->assertEquals(0, count($contact->notes)); - + //lists $this->assertInstanceOf("Ctct\Components\Contacts\ContactList", $contact->lists[0]); $this->assertEquals(1, $contact->lists[0]->id); @@ -139,7 +162,7 @@ public function testGetContactsNoNextLink() $this->assertEquals("", $contact->email_addresses[0]->opt_out_date); $this->assertEquals("anothertest@roving.com", $contact->email_addresses[0]->email_address); } - + public function testGetContact() { $curlResponse = CurlResponse::create(JsonLoader::getContactJson(), array('http_code' => 200)); @@ -149,7 +172,7 @@ public function testGetContact() ->will($this->returnValue($curlResponse)); $contact = $this->contactService->getContact('access_token', 1); - + $this->assertInstanceOf("Ctct\Components\Contacts\Contact", $contact); $this->assertEquals(238, $contact->id); $this->assertEquals("ACTIVE", $contact->status); @@ -166,14 +189,14 @@ public function testGetContact() $this->assertEquals("69f9d72b-0a5e-479d-b844-722b1da9595f", $contact->source_details); $this->assertEquals(false, $contact->confirmed); $this->assertEquals("API", $contact->source); - + // custom fields $this->assertInstanceOf("Ctct\Components\Contacts\CustomField", $contact->custom_fields[0]); $this->assertEquals("CustomField1", $contact->custom_fields[0]->name); $this->assertEquals("3/28/2011 11:09 AM EDT", $contact->custom_fields[0]->value); $this->assertEquals("CustomField2", $contact->custom_fields[1]->name); $this->assertEquals("Site owner", $contact->custom_fields[1]->value); - + //addresses $this->assertInstanceOf("Ctct\Components\Contacts\Address", $contact->addresses[0]); $this->assertEquals("1601 Trapelo Rd", $contact->addresses[0]->line1); @@ -185,13 +208,13 @@ public function testGetContact() $this->assertEquals("us", $contact->addresses[0]->country_code); $this->assertEquals("01720", $contact->addresses[0]->postal_code); $this->assertEquals("7885", $contact->addresses[0]->sub_postal_code); - + //notes $this->assertInstanceOf("Ctct\Components\Contacts\Note", $contact->notes[0]); $this->assertEquals(1, $contact->notes[0]->id); $this->assertEquals("Here are some cool notes to add", $contact->notes[0]->note); $this->assertEquals("2012-12-03T17:09:22.702Z", $contact->notes[0]->created_date); - + //lists $this->assertInstanceOf("Ctct\Components\Contacts\ContactList", $contact->lists[0]); $this->assertEquals(9, $contact->lists[0]->id); @@ -218,9 +241,9 @@ public function testGetContactByEmail() $response = $this->contactService->getContacts('access_token', array('email' => 'anothertest@roving.com')); $this->assertInstanceOf("Ctct\Components\ResultSet", $response); - $this->assertEquals('?next=c3RhcnRBdD0zJmxpbWl0PTI', $response->next); + $this->assertEquals('c3RhcnRBdD0zJmxpbWl0PTI', $response->next); $contact = $response->results[1]; - + $this->assertInstanceOf("Ctct\Components\Contacts\Contact", $contact); $this->assertEquals(231, $contact->id); $this->assertEquals("ACTIVE", $contact->status); @@ -234,12 +257,12 @@ public function testGetContactByEmail() $this->assertEquals("details", $contact->source_details); $this->assertEquals(false, $contact->confirmed); $this->assertEquals("", $contact->source); - + // custom fields $this->assertInstanceOf("Ctct\Components\Contacts\CustomField", $contact->custom_fields[0]); $this->assertEquals("CustomField1", $contact->custom_fields[0]->name); $this->assertEquals("1", $contact->custom_fields[0]->value); - + //addresses $this->assertInstanceOf("Ctct\Components\Contacts\Address", $contact->addresses[0]); $this->assertEquals("Suite 101", $contact->addresses[0]->line1); @@ -251,10 +274,10 @@ public function testGetContactByEmail() $this->assertEquals("us", $contact->addresses[0]->country_code); $this->assertEquals("53027", $contact->addresses[0]->postal_code); $this->assertEquals("", $contact->addresses[0]->sub_postal_code); - + //notes $this->assertEquals(0, count($contact->notes)); - + //lists $this->assertInstanceOf("Ctct\Components\Contacts\ContactList", $contact->lists[0]); $this->assertEquals(1, $contact->lists[0]->id); @@ -277,8 +300,8 @@ public function testAddContact() ->method('post') ->with() ->will($this->returnValue($curlResponse)); - - $contact = $this->contactService->addContact('access_token', new Contact()); + + $contact = $this->contactService->addContact('access_token', new Contact(), array()); $this->assertInstanceOf("Ctct\Components\Contacts\Contact", $contact); $this->assertEquals(238, $contact->id); $this->assertEquals("ACTIVE", $contact->status); @@ -295,14 +318,14 @@ public function testAddContact() $this->assertEquals("69f9d72b-0a5e-479d-b844-722b1da9595f", $contact->source_details); $this->assertEquals(false, $contact->confirmed); $this->assertEquals("API", $contact->source); - + // custom fields $this->assertInstanceOf("Ctct\Components\Contacts\CustomField", $contact->custom_fields[0]); $this->assertEquals("CustomField1", $contact->custom_fields[0]->name); $this->assertEquals("3/28/2011 11:09 AM EDT", $contact->custom_fields[0]->value); $this->assertEquals("CustomField2", $contact->custom_fields[1]->name); $this->assertEquals("Site owner", $contact->custom_fields[1]->value); - + //addresses $this->assertInstanceOf("Ctct\Components\Contacts\Address", $contact->addresses[0]); $this->assertEquals("1601 Trapelo Rd", $contact->addresses[0]->line1); @@ -314,13 +337,13 @@ public function testAddContact() $this->assertEquals("us", $contact->addresses[0]->country_code); $this->assertEquals("01720", $contact->addresses[0]->postal_code); $this->assertEquals("7885", $contact->addresses[0]->sub_postal_code); - + //notes $this->assertInstanceOf("Ctct\Components\Contacts\Note", $contact->notes[0]); $this->assertEquals(1, $contact->notes[0]->id); $this->assertEquals("Here are some cool notes to add", $contact->notes[0]->note); $this->assertEquals("2012-12-03T17:09:22.702Z", $contact->notes[0]->created_date); - + //lists $this->assertInstanceOf("Ctct\Components\Contacts\ContactList", $contact->lists[0]); $this->assertEquals(9, $contact->lists[0]->id); @@ -335,7 +358,7 @@ public function testAddContact() $this->assertEquals("2012-03-29T14:59:25.427Z", $contact->email_addresses[0]->opt_out_date); $this->assertEquals("john+smith@gmail.com", $contact->email_addresses[0]->email_address); } - + public function testDeleteContact() { $curlResponse = CurlResponse::create(null, array('http_code' => 204)); @@ -347,7 +370,7 @@ public function testDeleteContact() $response = $this->contactService->deleteContact('access_token', 1); $this->assertTrue($response); } - + public function testDeleteContactFailed() { $curlResponse = CurlResponse::create(null, array('http_code' => 400)); @@ -355,11 +378,11 @@ public function testDeleteContactFailed() ->method('delete') ->with() ->will($this->returnValue($curlResponse)); - + $response = $this->contactService->deleteContact('access_token', 1); $this->assertFalse($response); } - + public function testDeleteContactFromLists() { $curlResponse = CurlResponse::create(null, array('http_code' => 204)); @@ -371,7 +394,7 @@ public function testDeleteContactFromLists() $response = $this->contactService->deleteContactFromLists('access_token', 9); $this->assertTrue($response); } - + public function testDeleteContactFromListsFailed() { $curlResponse = CurlResponse::create(null, array('http_code' => 400), null); @@ -380,11 +403,11 @@ public function testDeleteContactFromListsFailed() ->method('delete') ->with() ->will($this->returnValue($curlResponse)); - + $response = $this->contactService->deleteContactFromLists('access_token', 9); $this->assertFalse($response); } - + public function testDeleteContactFromList() { $curlResponse = CurlResponse::create(null, array('http_code' => 204)); @@ -396,7 +419,7 @@ public function testDeleteContactFromList() $response = $this->contactService->deleteContactFromList('access_token', 9, 1); $this->assertTrue($response); } - + public function testDeleteContactFromListFailed() { $curlResponse = CurlResponse::create(null, array('http_code' => 400)); @@ -408,7 +431,7 @@ public function testDeleteContactFromListFailed() $response = $this->contactService->deleteContactFromList('access_token', 9, 1); $this->assertFalse($response); } - + public function testUpdateContact() { $curlResponse = CurlResponse::create(JsonLoader::getContactJson(), array('http_code' => 200)); @@ -417,7 +440,7 @@ public function testUpdateContact() ->with() ->will($this->returnValue($curlResponse)); - $contact = $this->contactService->updateContact('access_token', new Contact()); + $contact = $this->contactService->updateContact('access_token', new Contact(), array()); $this->assertInstanceOf("Ctct\Components\Contacts\Contact", $contact); $this->assertEquals(238, $contact->id); @@ -435,14 +458,14 @@ public function testUpdateContact() $this->assertEquals("69f9d72b-0a5e-479d-b844-722b1da9595f", $contact->source_details); $this->assertEquals(false, $contact->confirmed); $this->assertEquals("API", $contact->source); - + // custom fields $this->assertInstanceOf("Ctct\Components\Contacts\CustomField", $contact->custom_fields[0]); $this->assertEquals("CustomField1", $contact->custom_fields[0]->name); $this->assertEquals("3/28/2011 11:09 AM EDT", $contact->custom_fields[0]->value); $this->assertEquals("CustomField2", $contact->custom_fields[1]->name); $this->assertEquals("Site owner", $contact->custom_fields[1]->value); - + //addresses $this->assertInstanceOf("Ctct\Components\Contacts\Address", $contact->addresses[0]); $this->assertEquals("1601 Trapelo Rd", $contact->addresses[0]->line1); @@ -454,13 +477,13 @@ public function testUpdateContact() $this->assertEquals("us", $contact->addresses[0]->country_code); $this->assertEquals("01720", $contact->addresses[0]->postal_code); $this->assertEquals("7885", $contact->addresses[0]->sub_postal_code); - + //notes $this->assertInstanceOf("Ctct\Components\Contacts\Note", $contact->notes[0]); $this->assertEquals(1, $contact->notes[0]->id); $this->assertEquals("Here are some cool notes to add", $contact->notes[0]->note); $this->assertEquals("2012-12-03T17:09:22.702Z", $contact->notes[0]->created_date); - + //lists $this->assertInstanceOf("Ctct\Components\Contacts\ContactList", $contact->lists[0]); $this->assertEquals(9, $contact->lists[0]->id); diff --git a/test/Services/ContactTrackingServiceUnitTest.php b/test/Services/ContactTrackingServiceUnitTest.php index 21bf7e3..19a026d 100755 --- a/test/Services/ContactTrackingServiceUnitTest.php +++ b/test/Services/ContactTrackingServiceUnitTest.php @@ -28,7 +28,7 @@ public function testGetBounces() $this->assertInstanceOf("Ctct\Components\ResultSet", $resultSet); $this->assertInstanceOf("Ctct\Components\Tracking\BounceActivity", $resultSet->results[0]); - $this->assertEquals("?next=bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); + $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_BOUNCE", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("2", $resultSet->results[0]->contact_id); @@ -55,7 +55,7 @@ public function testGetClicks() $this->assertInstanceOf("Ctct\Components\ResultSet", $resultSet); $this->assertInstanceOf("Ctct\Components\Tracking\ClickActivity", $resultSet->results[0]); - $this->assertEquals("?next=bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); + $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_CLICK", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("69", $resultSet->results[0]->contact_id); @@ -80,7 +80,7 @@ public function testGetForwards() $this->assertInstanceOf("Ctct\Components\ResultSet", $resultSet); $this->assertInstanceOf("Ctct\Components\Tracking\ForwardActivity", $resultSet->results[0]); - $this->assertEquals("?next=bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); + $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_FORWARD", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("74", $resultSet->results[0]->contact_id); @@ -104,7 +104,7 @@ public function testGetUnsubscribes() $this->assertInstanceOf("Ctct\Components\ResultSet", $resultSet); $this->assertInstanceOf("Ctct\Components\Tracking\UnsubscribeActivity", $resultSet->results[0]); - $this->assertEquals("?next=bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); + $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_UNSUBSCRIBE", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("58", $resultSet->results[0]->contact_id); @@ -130,7 +130,7 @@ public function testGetSends() $this->assertInstanceOf("Ctct\Components\ResultSet", $resultSet); $this->assertInstanceOf("Ctct\Components\Tracking\SendActivity", $resultSet->results[0]); - $this->assertEquals("?next=bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); + $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_SEND", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("55", $resultSet->results[0]->contact_id); @@ -154,7 +154,7 @@ public function testGetOpens() $this->assertInstanceOf("Ctct\Components\ResultSet", $resultSet); $this->assertInstanceOf("Ctct\Components\Tracking\OpenActivity", $resultSet->results[0]); - $this->assertEquals("?next=bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); + $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next); $this->assertEquals("EMAIL_OPEN", $resultSet->results[0]->activity_type); $this->assertEquals(1100394165290, $resultSet->results[0]->campaign_id); $this->assertEquals("86", $resultSet->results[0]->contact_id); diff --git a/test/Services/EmailCampaignServiceUnitTest.php b/test/Services/EmailCampaignServiceUnitTest.php index 428b7b2..1970091 100755 --- a/test/Services/EmailCampaignServiceUnitTest.php +++ b/test/Services/EmailCampaignServiceUnitTest.php @@ -4,7 +4,7 @@ use Ctct\Util\RestClient; use Ctct\Util\CurlResponse; use Ctct\Components\EmailMarketing\Campaign; - + class EmailMarketingServiceUnitTest extends PHPUnit_Framework_TestCase { private $restClient; @@ -16,6 +16,33 @@ public function setUp() $this->emailMarketingService = new EmailMarketingService("apikey", $this->restClient); } + public function testGetCampaignsModifiedSince() + { + $curlResponse = CurlResponse::create(JsonLoader::getCampaignModifiedSinceJson(1), array('http_code' => 200)); + $this->restClient->expects($this->once()) + ->method('get') + ->with() + ->will($this->returnValue($curlResponse)); + + $response = $this->emailMarketingService->getCampaigns( + 'access_token', + array('modified_since' => '2013-01-12T20:04:59.436Z', 'limit' => 2) + ); + $campaigns = $response->results; + + $this->assertInstanceOf('Ctct\Components\EmailMarketing\Campaign', $campaigns[0]); + $this->assertEquals("ABcGFnZU51bT0yJnBhZ2VTaXplPTImbW9kaWZpZWRfc2luY2U9MTM1OTUxNjYzMDU5MA", $response->next); + $this->assertEquals("9112921497760", $campaigns[0]->id); + $this->assertEquals("Email Created 2013/03/29, 11:30 PM", $campaigns[0]->name); + $this->assertEquals("DRAFT", $campaigns[0]->status); + $this->assertEquals("2013-03-30T03:30:48.033Z", $campaigns[0]->modified_date); + + $this->assertEquals("9112756952331", $campaigns[1]->id); + $this->assertEquals("CampaignName234", $campaigns[1]->name); + $this->assertEquals("DRAFT", $campaigns[1]->status); + $this->assertEquals("2013-03-14T15:00:07.883Z", $campaigns[1]->modified_date); + } + public function testGetCampaigns() { $curlResponse = CurlResponse::create(JsonLoader::getCampaignsJson(), array('http_code' => 200)); @@ -28,7 +55,7 @@ public function testGetCampaigns() $campaigns = $response->results; $this->assertInstanceOf('Ctct\Components\EmailMarketing\Campaign', $campaigns[0]); - $this->assertEquals("?next=cGFnZU51bT0yJnBhZ2VTaXplPTM", $response->next); + $this->assertEquals("cGFnZU51bT0yJnBhZ2VTaXplPTM", $response->next); $this->assertEquals("1100371240640", $campaigns[0]->id); $this->assertEquals("Email Created 2012/11/29, 4:13 PM", $campaigns[0]->name); $this->assertEquals("SENT", $campaigns[0]->status); @@ -67,7 +94,7 @@ public function testDeleteCampaignFailed() public function testGetCampaign() { $curlResponse = CurlResponse::create(JsonLoader::getCampaignJson(), array('http_code' => 201)); - $this->restClient->expects($this->once()) + $this->restClient->expects($this->once()) ->method('get') ->with() ->will($this->returnValue($curlResponse)); @@ -92,6 +119,7 @@ public function testGetCampaign() $this->assertEquals("Hi", $campaign->greeting_salutations); $this->assertEquals("FIRST_NAME", $campaign->greeting_name); $this->assertEquals("", $campaign->greeting_string); + $this->assertEquals("http://www.constantcontact.com", $campaign->permalink_url); $this->assertEquals( "Hi Visit ConstantContact.com! ", @@ -123,6 +151,7 @@ public function testGetCampaign() $this->assertEquals(3, $campaign->tracking_summary->forwards); $this->assertEquals(2, $campaign->tracking_summary->unsubscribes); $this->assertEquals(18, $campaign->tracking_summary->bounces); + $this->assertEquals(1, $campaign->tracking_summary->spam_count); // sent to contact lists $this->assertEquals(1, count($campaign->sent_to_contact_lists)); diff --git a/test/Services/ListServiceUnitTest.php b/test/Services/ListServiceUnitTest.php index 1d89adb..0d69655 100755 --- a/test/Services/ListServiceUnitTest.php +++ b/test/Services/ListServiceUnitTest.php @@ -25,7 +25,29 @@ public function testGetLists() ->will($this->returnValue($curlResponse)); $response = $this->listService->getLists('access_token'); - + + $this->assertInstanceOf("Ctct\Components\Contacts\ContactList", $response[0]); + $this->assertEquals(1, $response[0]->id); + $this->assertEquals("General Interest", $response[0]->name); + $this->assertEquals("ACTIVE", $response[0]->status); + $this->assertEquals(17, $response[0]->contact_count); + + $this->assertEquals(3, $response[1]->id); + $this->assertEquals("mod_Test List 1", $response[1]->name); + $this->assertEquals("HIDDEN", $response[1]->status); + $this->assertEquals(18, $response[1]->contact_count); + } + + public function testGetListsModifiedSince() + { + $curlResponse = CurlResponse::create(JsonLoader::getListsJson(), array('http_code' => 200)); + $this->restClient->expects($this->once()) + ->method('get') + ->with() + ->will($this->returnValue($curlResponse)); + + $response = $this->listService->getLists('access_token', array('modified_since' => '2013-01-12T20:04:59.436Z')); + $this->assertInstanceOf("Ctct\Components\Contacts\ContactList", $response[0]); $this->assertEquals(1, $response[0]->id); $this->assertEquals("General Interest", $response[0]->name); @@ -37,7 +59,7 @@ public function testGetLists() $this->assertEquals("HIDDEN", $response[1]->status); $this->assertEquals(18, $response[1]->contact_count); } - + public function testGetList() { $curlResponse = CurlResponse::create(JsonLoader::getListJson(), array('http_code' => 200)); @@ -69,7 +91,7 @@ public function testAddList() $this->assertEquals("HIDDEN", $list->status); $this->assertEquals(19, $list->contact_count); } - + public function testUpdateList() { $curlResponse = CurlResponse::create(JsonLoader::getListJson(), array('http_code' => 200)); @@ -85,7 +107,7 @@ public function testUpdateList() $this->assertEquals("HIDDEN", $list->status); $this->assertEquals(19, $list->contact_count); } - + public function testGetContactsFromList() { $curlResponse = CurlResponse::create(JsonLoader::getContactsJson(), array('http_code' => 200));