├── log.html
├── log2.html
├── .gitignore
├── img
└── guide
│ ├── app-id.png
│ ├── page-id.png
│ ├── page-token.png
│ ├── choose-app-setup.png
│ └── create-app-form.png
├── languages
├── mbot-woocommerce-de_DE.mo
├── mbot-woocommerce.pot
└── mbot-woocommerce-de_DE.po
├── config.php
├── inc
├── error-log.php
├── webhook-setup.php
├── filter-functions.php
├── footer-script.php
├── derweili-message.php
├── shipping.php
├── checkout-fields.php
├── update.php
├── mbot-order.php
├── domain-whitelisting.php
├── woocommerce-thank-you.php
├── derweili-structured-message.php
├── order-status-action-manager.php
├── guide.php
├── woocommerce-order-status-messages.php
├── settingspage.php
├── WooOrderMessage.php
└── wc-plugin-settings.php
├── css
├── guide.css
├── tourist.css
└── jquery.qtip.css
├── install.php
├── vendor
└── fb-messenger-php
│ ├── composer.json
│ ├── README.md
│ ├── Messages
│ ├── Summary.php
│ ├── Address.php
│ ├── Adjustment.php
│ ├── QuickReply.php
│ ├── FileMessage.php
│ ├── AudioMessage.php
│ ├── VideoMessage.php
│ ├── MessageReceiptElement.php
│ ├── ImageMessage.php
│ ├── MessageButton.php
│ ├── Message.php
│ ├── MessageElement.php
│ ├── Attachment.php
│ └── StructuredMessage.php
│ ├── UserProfile.php
│ ├── .gitignore
│ └── FbBotApp.php
├── uninstall.php
├── readme.md
├── js
├── guide.js
├── tourist.min.js
└── backbone-min.js
├── readme.txt
├── mbot-woocommerce.php
└── webhook.php
/log.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/log2.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | test.php
2 |
--------------------------------------------------------------------------------
/img/guide/app-id.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/derweili/fb-messenger-bot-for-woocommerce/HEAD/img/guide/app-id.png
--------------------------------------------------------------------------------
/img/guide/page-id.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/derweili/fb-messenger-bot-for-woocommerce/HEAD/img/guide/page-id.png
--------------------------------------------------------------------------------
/img/guide/page-token.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/derweili/fb-messenger-bot-for-woocommerce/HEAD/img/guide/page-token.png
--------------------------------------------------------------------------------
/img/guide/choose-app-setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/derweili/fb-messenger-bot-for-woocommerce/HEAD/img/guide/choose-app-setup.png
--------------------------------------------------------------------------------
/img/guide/create-app-form.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/derweili/fb-messenger-bot-for-woocommerce/HEAD/img/guide/create-app-form.png
--------------------------------------------------------------------------------
/languages/mbot-woocommerce-de_DE.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/derweili/fb-messenger-bot-for-woocommerce/HEAD/languages/mbot-woocommerce-de_DE.mo
--------------------------------------------------------------------------------
/config.php:
--------------------------------------------------------------------------------
1 | '',
9 | 'token' => ''
10 | ];
--------------------------------------------------------------------------------
/inc/error-log.php:
--------------------------------------------------------------------------------
1 | regenerate_permalinks();
18 | }
19 |
20 | function regenerate_permalinks() {
21 |
22 | mbot_webhook_endpoint(); // register webhook endpoints
23 |
24 | flush_rewrite_rules(); // flush rewrite rules
25 |
26 | }
27 |
28 |
29 | }
30 |
31 | function mbot_install_mbot() {
32 | new DERWEILI_Mbot_Install();
33 | }
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "pimax/fb-messenger-php",
3 | "description": " Facebook Messenger Bot PHP API",
4 | "homepage": "https://github.com/pimax/fb-messenger-php",
5 | "license": "MIT",
6 | "authors": [
7 | {
8 | "name": "Max Pinyugin",
9 | "email": "m.pinyugin@gmail.com",
10 | "homepage": "http://russian-developers.com",
11 | "role": "Developer"
12 | }
13 | ],
14 | "require": {
15 | "php": ">=5.4.0"
16 | },
17 |
18 | "autoload": {
19 | "psr-4": { "pimax\\": "" }
20 | }
21 | }
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/README.md:
--------------------------------------------------------------------------------
1 | FB Messenger Bot PHP API
2 | ========================
3 |
4 | This is a PHP implementation for Facebook Messenger Bot API.
5 |
6 | REQUIREMENTS
7 | ------------
8 | The minimum requirement is that your Web server supports PHP 5.4.
9 |
10 | INSTALLATION
11 | ------------
12 |
13 | ```
14 | composer require "pimax/fb-messenger-php" "dev-master"
15 | ```
16 |
17 | BASIC USAGE
18 | ------------
19 | See this repo - [https://github.com/pimax/fb-messenger-php-example](https://github.com/pimax/fb-messenger-php-example)
20 |
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/Messages/Summary.php:
--------------------------------------------------------------------------------
1 | data = $data;
30 | }
31 |
32 | /**
33 | * Get Data
34 | *
35 | * @return array
36 | */
37 | public function getData()
38 | {
39 | return $this->data;
40 | }
41 | }
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/Messages/Address.php:
--------------------------------------------------------------------------------
1 | data = $data;
31 | }
32 |
33 | /**
34 | * Get Data
35 | *
36 | * @return array
37 | */
38 | public function getData()
39 | {
40 | return $this->data;
41 | }
42 | }
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/Messages/Adjustment.php:
--------------------------------------------------------------------------------
1 | data = $data;
30 | }
31 |
32 | /**
33 | * Get Data
34 | *
35 | * @return array
36 | */
37 | public function getData()
38 | {
39 | return $this->data;
40 | }
41 | }
--------------------------------------------------------------------------------
/inc/webhook-setup.php:
--------------------------------------------------------------------------------
1 | query_vars ) ) {
23 |
24 | //mcwh_action_webhook();
25 | do_action( 'mbot_messenger_callback_webhook' );
26 |
27 | exit();
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/UserProfile.php:
--------------------------------------------------------------------------------
1 | data = $data;
17 | }
18 |
19 | public function getFirstName()
20 | {
21 | return $this->data['first_name'];
22 | }
23 |
24 | public function getLastName()
25 | {
26 | return $this->data['last_name'];
27 | }
28 |
29 | public function getPicture()
30 | {
31 | return $this->data['profile_pic'];
32 | }
33 |
34 | public function getLocale()
35 | {
36 | return $this->data['locale'];
37 | }
38 |
39 | public function getTimezone()
40 | {
41 | return $this->data['timezone'];
42 | }
43 |
44 | public function getGender()
45 | {
46 | return $this->data['gender'];
47 | }
48 | }
--------------------------------------------------------------------------------
/inc/filter-functions.php:
--------------------------------------------------------------------------------
1 | quick_replies = $quick_replies;
30 | parent::__construct($recipient,$text);
31 | }
32 | public function getData() {
33 | return [
34 | 'recipient' => [
35 | 'id' => $this->recipient
36 | ],
37 | 'message' => [
38 | 'text' => $this->text,
39 | 'quick_replies'=>$this->quick_replies
40 | ]
41 | ];
42 |
43 |
44 | }
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/uninstall.php:
--------------------------------------------------------------------------------
1 | remove_site_from_whitelisted_domains();
23 | $this->remove_options();
24 | }
25 |
26 | function remove_site_from_whitelisted_domains() {
27 |
28 | $settings = new DERWEEILI_MBOT_WOOCOMMERCE_SETTINGS_PAGE();
29 | $settings->domain_whitelisting_button('remove');
30 |
31 | }
32 |
33 | function remove_options() {
34 |
35 | delete_option( 'derweili_mbot_page_token' );
36 | delete_option( 'derweili_mbot_verify_token' );
37 | delete_option( 'derweili_mbot_messenger_app_id' );
38 | delete_option( 'derweili_mbot_page_id' );
39 |
40 | delete_option( 'derweili_mbot_checkbox_size' );
41 | delete_option( 'derweili_mbot_button_color' );
42 | delete_option( 'derweili_mbot_fb_checkbox_prechecked' );
43 | delete_option( 'derweili_mbot_fb_checkbox_allow_login' );
44 | }
45 |
46 | }
47 |
48 | new DERWEILI_Mbot_Uninstall();
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | #Messengerbot for WooCommerce
2 |
3 | Tags: WooCommerce, Facebook, Messenger, Bot
4 |
5 | Requires at least: 4.0
6 |
7 | Tested up to: 4.5
8 |
9 | License: GPL
10 |
11 | ##Messenger Bot for WooCommerce
12 | Notify your customers about their orders via Facebook Messenger
13 |
14 | ##Installation
15 | Install the Plugin via the Wordpress Backend.
16 |
17 | Setup a Facebook App as described here:
18 | https://developers.facebook.com/docs/messenger-platform/quickstart
19 |
20 | Go To WooCommerce > Settings > Messenger Bot and enter your credentials
21 |
22 | You can find the callback URL on the WooCommerce > Settings > Messenger Bot screen
23 |
24 | ## Credits:
25 | Many Thanks to pimax. This WordPress Plugins makes use of the PHP implementation for Facebook Messenger Bot API developed by [Pimax Interactive](https://github.com/pimax)
26 | https://github.com/pimax/fb-messenger-php
27 |
28 | ## Changelog:
29 |
30 | **1.0**
31 | - New feature: support for checkbox plugin added
32 |
33 | **0.2**
34 |
35 | - New feature: Send order fees as "adjustments" to Facebook
36 | - New feature: Send customer order notes as messenger text message
37 |
38 |
39 | **0.1** initial release
40 |
41 |
42 |
43 |
44 | ## To Do's:
45 |
46 | -- find out why Order status updated do not work anymore
47 |
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/Messages/FileMessage.php:
--------------------------------------------------------------------------------
1 | recipient = $recipient;
37 | $this->text = $file;
38 |
39 | }
40 |
41 | /**
42 | * Get message data
43 | *
44 | * @return array
45 | */
46 | public function getData()
47 | {
48 | $res = [
49 | 'recipient' => [
50 | 'id' => $this->recipient
51 | ]
52 | ];
53 |
54 | $attachment = new Attachment(Attachment::TYPE_FILE);
55 |
56 | if (strpos($this->text, 'http://') === 0 || strpos($this->text, 'https://') === 0) {
57 | $attachment->setPayload(array('url' => $this->text));
58 | } else {
59 | $attachment->setFileData($this->getCurlValue($this->text, mime_content_type($this->text), basename($this->text)));
60 | }
61 |
62 | $res['message'] = $attachment->getData();
63 |
64 | return $res;
65 | }
66 | }
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/Messages/AudioMessage.php:
--------------------------------------------------------------------------------
1 | recipient = $recipient;
37 | $this->text = $file;
38 |
39 | }
40 |
41 | /**
42 | * Get message data
43 | *
44 | * @return array
45 | */
46 | public function getData()
47 | {
48 | $res = [
49 | 'recipient' => [
50 | 'id' => $this->recipient
51 | ]
52 | ];
53 |
54 | $attachment = new Attachment(Attachment::TYPE_AUDIO);
55 |
56 | if (strpos($this->text, 'http://') === 0 || strpos($this->text, 'https://') === 0) {
57 | $attachment->setPayload(array('url' => $this->text));
58 | } else {
59 | $attachment->setFileData($this->getCurlValue($this->text, mime_content_type($this->text), basename($this->text)));
60 | }
61 |
62 | $res['message'] = $attachment->getData();
63 |
64 | return $res;
65 | }
66 | }
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/Messages/VideoMessage.php:
--------------------------------------------------------------------------------
1 | recipient = $recipient;
37 | $this->text = $file;
38 |
39 | }
40 |
41 | /**
42 | * Get message data
43 | *
44 | * @return array
45 | */
46 | public function getData()
47 | {
48 | $res = [
49 | 'recipient' => [
50 | 'id' => $this->recipient
51 | ]
52 | ];
53 |
54 | $attachment = new Attachment(Attachment::TYPE_VIDEO);
55 |
56 | if (strpos($this->text, 'http://') === 0 || strpos($this->text, 'https://') === 0) {
57 | $attachment->setPayload(array('url' => $this->text));
58 | } else {
59 | $attachment->setFileData($this->getCurlValue($this->text, mime_content_type($this->text), basename($this->text)));
60 | }
61 |
62 | $res['message'] = $attachment->getData();
63 |
64 | return $res;
65 | }
66 | }
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/Messages/MessageReceiptElement.php:
--------------------------------------------------------------------------------
1 | title = $title;
46 | $this->subtitle = $subtitle;
47 | $this->image_url = $image_url;
48 | $this->quantity = $quantity;
49 | $this->price = $price;
50 | $this->currency = $currency;
51 | }
52 |
53 | /**
54 | * @return array
55 | */
56 | public function getData()
57 | {
58 | return [
59 | 'title' => $this->title,
60 | 'subtitle' => $this->subtitle,
61 | 'image_url' => $this->image_url,
62 | 'quantity' => $this->quantity,
63 | 'price' => $this->price,
64 | 'currency' => $this->currency
65 | ];
66 | }
67 | }
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### OSX template
3 | .DS_Store
4 | .AppleDouble
5 | .LSOverride
6 |
7 | # Icon must end with two \r
8 | Icon
9 |
10 | # Thumbnails
11 | ._*
12 |
13 | # Files that might appear in the root of a volume
14 | .DocumentRevisions-V100
15 | .fseventsd
16 | .Spotlight-V100
17 | .TemporaryItems
18 | .Trashes
19 | .VolumeIcon.icns
20 |
21 | # Directories potentially created on remote AFP share
22 | .AppleDB
23 | .AppleDesktop
24 | Network Trash Folder
25 | Temporary Items
26 | .apdisk
27 | ### JetBrains template
28 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
29 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
30 |
31 | # User-specific stuff:
32 | .idea/workspace.xml
33 | .idea/tasks.xml
34 | .idea/dictionaries
35 | .idea/vcs.xml
36 | .idea/jsLibraryMappings.xml
37 |
38 | # Sensitive or high-churn files:
39 | .idea/dataSources.ids
40 | .idea/dataSources.xml
41 | .idea/dataSources.local.xml
42 | .idea/sqlDataSources.xml
43 | .idea/dynamic.xml
44 | .idea/uiDesigner.xml
45 |
46 | # Gradle:
47 | .idea/gradle.xml
48 | .idea/libraries
49 |
50 | # Mongo Explorer plugin:
51 | .idea/mongoSettings.xml
52 |
53 | ## File-based project format:
54 | *.iws
55 |
56 | ## Plugin-specific files:
57 |
58 | # IntelliJ
59 | /out/
60 |
61 | # mpeltonen/sbt-idea plugin
62 | .idea_modules/
63 |
64 | # JIRA plugin
65 | atlassian-ide-plugin.xml
66 |
67 | # Crashlytics plugin (for Android Studio and IntelliJ)
68 | com_crashlytics_export_strings.xml
69 | crashlytics.properties
70 | crashlytics-build.properties
71 | fabric.properties
72 |
73 |
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/Messages/ImageMessage.php:
--------------------------------------------------------------------------------
1 | recipient = $recipient;
37 | $this->text = $file;
38 |
39 | }
40 |
41 | /**
42 | * Get message data
43 | *
44 | * @return array
45 | */
46 | public function getData()
47 | {
48 | $res = [
49 | 'recipient' => [
50 | 'id' => $this->recipient
51 | ]
52 | ];
53 |
54 | $attachment = new Attachment(Attachment::TYPE_IMAGE);
55 |
56 | if (strpos($this->text, 'http://') === 0 || strpos($this->text, 'https://') === 0) {
57 | $attachment->setPayload(array('url' => $this->text));
58 | $res['message'] = $attachment->getData();
59 | } else {
60 | $attachment->setPayload(array('url' => basename($this->text)));
61 | $attachment->setFileData($this->getCurlValue($this->text, mime_content_type($this->text), basename($this->text)));
62 | $res['message'] = $attachment->getData();
63 | $res['filedata'] = $res['message']['filedata'];
64 | unset($res['message']['filedata']);
65 | }
66 |
67 | return $res;
68 | }
69 | }
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/Messages/MessageButton.php:
--------------------------------------------------------------------------------
1 | type = $type;
57 | $this->title = $title;
58 |
59 | if (!$url) {
60 | $url = $title;
61 | }
62 |
63 | $this->url = $url;
64 | }
65 |
66 | /**
67 | * Get Button data
68 | *
69 | * @return array
70 | */
71 | public function getData()
72 | {
73 | $result = [
74 | 'type' => $this->type,
75 | 'title' => $this->title,
76 | ];
77 |
78 | switch($this->type)
79 | {
80 | case self::TYPE_POSTBACK:
81 | $result['payload'] = $this->url;
82 | break;
83 |
84 | case self::TYPE_WEB:
85 | $result['url'] = $this->url;
86 | break;
87 | }
88 |
89 | return $result;
90 | }
91 | }
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/Messages/Message.php:
--------------------------------------------------------------------------------
1 | recipient = $recipient;
37 | $this->text = $text;
38 |
39 | }
40 |
41 | /**
42 | * Get message data
43 | *
44 | * @return array
45 | */
46 | public function getData()
47 | {
48 | return [
49 | 'recipient' => [
50 | 'id' => $this->recipient
51 | ],
52 | 'message' => [
53 | 'text' => $this->text
54 | ]
55 | ];
56 | }
57 |
58 | /**
59 | * @param string $filename
60 | * @param string $contentType
61 | * @param string $postname
62 | * @return \CURLFile|string
63 | */
64 | protected function getCurlValue($filename, $contentType, $postname)
65 | {
66 | // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax
67 | // See: https://wiki.php.net/rfc/curl-file-upload
68 | if (function_exists('curl_file_create')) {
69 | return curl_file_create($filename, $contentType, $postname);
70 | }
71 |
72 | // Use the old style if using an older version of PHP
73 | $value = "@{$this->filename};filename=" . $postname;
74 | if ($contentType) {
75 | $value .= ';type=' . $contentType;
76 | }
77 |
78 | return $value;
79 | }
80 | }
--------------------------------------------------------------------------------
/css/tourist.css:
--------------------------------------------------------------------------------
1 | .tour-highlight{
2 | background: transparent;
3 | -moz-box-shadow: 0px 0px 7px 0px rgba(0, 241, 255, 0.701961);
4 | -webkit-box-shadow: 0px 0px 7px 0px rgba(0, 241, 255, 0.701961);
5 | -o-box-shadow: 0px 0px 7px 0px rgba(0, 241, 255, 0.701961);
6 | box-shadow: 0px 0px 7px 0px rgba(0, 241, 255, 0.701961);
7 | border-radius: 2px;
8 | }
9 |
10 | /* bootstrap styles */
11 | .tourist-popover{
12 | padding: 0;
13 | }
14 | .tourist-popover .popover-content{
15 | padding: 10px 0 0 0;
16 | min-width: 200px;
17 | }
18 | .tourist-popover .popover-content p{
19 | margin: 0 8px 10px 8px;
20 | }
21 | .tourist-popover .popover-content .action-label{
22 | background: rgba(0, 111, 255, 0.168627);
23 | font-size: 14px;
24 | padding: 3px 10px;
25 | }
26 | .tourist-popover .popover-content .tour-counter{
27 | margin: 0; padding: 0;
28 | position: absolute;
29 | left: 10px; bottom: 14px;
30 | font-size: 11px;
31 | color: #acacac;
32 | }
33 | .tourist-popover .tour-buttons{
34 | padding: 8px 10px;
35 | min-height: 28px;
36 | background: #f5f5f5;
37 | border-radius: 0px 0px 6px 6px;
38 | box-sizing: content-box;
39 | }
40 | .tourist-popover .btn-close{
41 | background: none;
42 | border: none;
43 | position: absolute;
44 | top: 4px; right: 7px;
45 | padding: 0;
46 | opacity: .3;
47 | }
48 | .tourist-popover .btn-close:hover{
49 | opacity: .5;
50 | }
51 |
52 | /* qtip2 styles */
53 | .qtip-tour, .qtip-tour .qtip-content{
54 | padding: 0;
55 | }
56 | .qtip-tour .qtip-content{
57 | padding-top: 10px;
58 | }
59 | .qtip-tour .qtip-content p{
60 | margin: 0 8px 10px 8px;
61 | }
62 | .qtip-tour .qtip-content .action-label{
63 | background: rgba(0, 111, 255, 0.168627);
64 | font-size: 14px;
65 | padding: 3px 10px;
66 | }
67 | .qtip-tour .qtip-content .tour-counter{
68 | font-size: 11px;
69 | color: #acacac;
70 | }
71 | .qtip-tour .tour-buttons{
72 | padding: 8px 10px;
73 | min-height: 28px;
74 | background: #f5f5f5;
75 | border-radius: 0px 0px 6px 6px;
76 | box-sizing: content-box;
77 | }
78 |
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/Messages/MessageElement.php:
--------------------------------------------------------------------------------
1 | title = $title;
64 | $this->subtitle = $subtitle;
65 | $this->url = $url;
66 | $this->image_url = $image_url;
67 | $this->buttons = $buttons;
68 | }
69 |
70 | /**
71 | * Get Element data
72 | *
73 | * @return array
74 | */
75 | public function getData()
76 | {
77 | $result = [
78 | 'title' => $this->title,
79 | 'subtitle' => $this->subtitle,
80 | 'item_url' => $this->url,
81 | 'image_url' => $this->image_url,
82 | ];
83 |
84 | if (!empty($this->buttons)) {
85 | $result['buttons'] = [];
86 |
87 | foreach ($this->buttons as $btn) {
88 | $result['buttons'][] = $btn->getData();
89 | }
90 | }
91 |
92 | return $result;
93 | }
94 | }
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/Messages/Attachment.php:
--------------------------------------------------------------------------------
1 | type = $type;
44 | $this->payload = $payload;
45 | }
46 |
47 | /**
48 | * @return string
49 | */
50 | public function getType()
51 | {
52 | return $this->type;
53 | }
54 |
55 | /**
56 | * @param string $type
57 | */
58 | public function setType($type)
59 | {
60 | $this->type = $type;
61 | }
62 |
63 | /**
64 | * @return array
65 | */
66 | public function getPayload()
67 | {
68 | return $this->payload;
69 | }
70 |
71 | /**
72 | * @param array $payload
73 | */
74 | public function setPayload($payload)
75 | {
76 | $this->payload = $payload;
77 | }
78 |
79 | /**
80 | * @return string
81 | */
82 | public function getFileData()
83 | {
84 | return $this->fileData;
85 | }
86 |
87 | /**
88 | * @param string $fileData
89 | */
90 | public function setFileData($fileData)
91 | {
92 | $this->fileData = $fileData;
93 | }
94 |
95 | /**
96 | * @return array
97 | */
98 | public function getData()
99 | {
100 | $data = [
101 | 'attachment' => [
102 | 'type' => $this->type,
103 | 'payload' => $this->payload
104 | ]
105 | ];
106 | if (!empty($this->fileData)) {
107 | $data['filedata'] = $this->fileData;
108 | }
109 | return $data;
110 | }
111 | }
--------------------------------------------------------------------------------
/inc/footer-script.php:
--------------------------------------------------------------------------------
1 |
17 |
42 |
43 |
71 | FB.Event.subscribe('messenger_checkbox', function(e) {
72 | console.log("messenger_checkbox event");
73 | console.log(e);
74 |
75 | if (e.event == 'rendered') {
76 | console.log("Plugin was rendered");
77 | } else if (e.event == 'checkbox') {
78 | var checkboxState = e.state;
79 | console.log("Checkbox state: " + checkboxState);
80 |
81 | jQuery( messengerCheckboxUserTest ).val( checkboxState );
82 |
83 | } else if (e.event == 'not_you') {
84 | console.log("User clicked 'not you'");
85 | } else if (e.event == 'hidden') {
86 | console.log("Plugin was hidden");
87 | jQuery("#derweili_mbot_checkout_field").hide();
88 | }
89 |
90 | });
91 | First look at this thing
',
5 | highlightTarget: true,
6 | nextButton: true,
7 | target: jQuery('#derweili_mbot_verify_token'),
8 | my: 'top center',
9 | at: 'top center'
10 | }, {
11 | content: 'And then at this thing
',
12 | highlightTarget: true,
13 | nextButton: true,
14 | target: jQuery('#derweili_mbot_page_token'),
15 | my: 'top center',
16 | at: 'top center'
17 | }]
18 |
19 | var tour = new Tourist.Tour({
20 | steps: steps,
21 | tipClass: 'Bootstrap',
22 | tipOptions:{ showEffect: 'slidein' }
23 | });
24 |
25 | tour.start();
26 | console.log(tour);
27 | //alert("test");*/
28 |
29 | STEP_OPTIONS = {
30 | one: 1,
31 | two: 2
32 | };
33 |
34 | STEPS = [{
35 | content: "Please enter the ID of the \
36 | Facebook Page you want to connect. \
37 | Where can I find the Page ID? \
38 |
",
39 | highlightTarget: true,
40 | nextButton: true,
41 | target: $('#derweili_mbot_page_id'),
42 | my: 'top center',
43 | at: 'bottom center'
44 | },{
45 | content: 'Please enter the ID of you Facebook App \
46 | Don\'t know where to find the App ID or what a Facebook App is? \
47 |
',
48 | highlightTarget: true,
49 | nextButton: true,
50 | target: $('#derweili_mbot_messenger_app_id'),
51 | my: 'top center',
52 | at: 'bottom center'
53 | },{
54 | content: 'Please enter the Page Token. \
55 | Where do I get the Page Token? \
56 |
',
57 | highlightTarget: true,
58 | nextButton: true,
59 | target: $('#derweili_mbot_page_token'),
60 | my: 'top center',
61 | at: 'bottom center'
62 | },{
63 | content: 'Please add a unique verify token.
',
64 | highlightTarget: true,
65 | nextButton: true,
66 | target: $('#derweili_mbot_verify_token'),
67 | my: 'top center',
68 | at: 'bottom center'
69 | }]
70 |
71 | TOUR = new Tourist.Tour({
72 | stepOptions: STEP_OPTIONS,
73 | steps: STEPS,
74 | //cancelStep: @finalQuit
75 | //successStep: @finalSucceed
76 | tipClass: 'QTip',
77 | tipOptions:{
78 | style: {
79 | classes: 'qtip-tour qtip-bootstrap'
80 | }
81 | }
82 | });
83 | //TOUR.start();
84 |
85 | $('#mbot_settings_tutorial_button').click(function(e){
86 | TOUR.start();
87 | })
88 |
89 |
90 | }(jQuery));
--------------------------------------------------------------------------------
/inc/derweili-message.php:
--------------------------------------------------------------------------------
1 | recipient = $recipient;
37 | $this->text = $text;
38 | $this->is_reference = $is_reference;
39 | if( $is_reference ) $this->recipient_type = 'user_ref';
40 | //var_dump( $is_reference );
41 |
42 | }
43 |
44 | /**
45 | * Get message data
46 | *
47 | * @return array
48 | */
49 | public function getData()
50 | {
51 | $this->get_data_return['message'] = [
52 | 'text' => $this->text
53 | ];
54 |
55 | /*if ( $this->is_reference ) {
56 | $this->get_data_return['recipient'] = [
57 | 'user_ref' => $this->recipient
58 | ];
59 | }else{
60 | $this->get_data_return['recipient'] = [
61 | 'id' => $this->recipient
62 | ];
63 | }*/
64 |
65 | /*$this->get_data_return['recipient'] = [
66 | $this->$recipient_type => $this->recipient
67 | ];*/
68 |
69 | $this->get_data_return['recipient'] = array();
70 | $this->get_data_return['recipient'][$this->recipient_type] = $this->recipient;
71 |
72 |
73 | //var_dump( $this->get_data_return );
74 |
75 |
76 | return $this->get_data_return;
77 |
78 | }
79 |
80 | /**
81 | * @param string $filename
82 | * @param string $contentType
83 | * @param string $postname
84 | * @return \CURLFile|string
85 | */
86 | protected function getCurlValue($filename, $contentType, $postname)
87 | {
88 | // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax
89 | // See: https://wiki.php.net/rfc/curl-file-upload
90 | if (function_exists('curl_file_create')) {
91 | return curl_file_create($filename, $contentType, $postname);
92 | }
93 |
94 | // Use the old style if using an older version of PHP
95 | $value = "@{$this->filename};filename=" . $postname;
96 | if ($contentType) {
97 | $value .= ';type=' . $contentType;
98 | }
99 |
100 | return $value;
101 | }
102 | }
--------------------------------------------------------------------------------
/inc/shipping.php:
--------------------------------------------------------------------------------
1 | order_id = $order_id;
32 |
33 | $this->get_shipping_type();
34 |
35 | }
36 |
37 |
38 | private function get_shipping_type() {
39 |
40 | if ( ! empty( get_post_meta( $this->order_id, '_aftership_tracking_number', true ) ) ) {
41 |
42 | $this->tracking_plugin = "aftership";
43 |
44 | }elseif ( ! empty( get_post_meta( $this->order_id, '_tracking_number', true ) ) ) {
45 |
46 | $this->tracking_plugin = "WooCommerceShipmentTracking";
47 |
48 | }elseif ( ! empty( get_post_meta( $this->order_id, '_wcst_order_trackno', true ) ) ) {
49 |
50 | $this->tracking_plugin = "wcst";
51 |
52 | }
53 |
54 | }
55 |
56 | public function has_shipping() {
57 | if ( null != $this->tracking_plugin ) return true;
58 | }
59 |
60 | private function get_shipping_details() {
61 |
62 | switch ( $this->tracking_plugin ) {
63 | case 'aftership':
64 |
65 | $this->get_aftership_details();
66 |
67 | break;
68 | case 'WooCommerceShipmentTracking':
69 |
70 | $this->get_woocommerce_shipment_tracking();
71 |
72 | break;
73 | case 'wcst':
74 |
75 | $this->get_wcst_tracking();
76 |
77 | break;
78 |
79 | default:
80 | # code...
81 | break;
82 | }
83 |
84 | }
85 |
86 | private function get_aftership_details() {
87 |
88 | $this->tracking_code = get_post_meta( $this->order_id, '_aftership_tracking_number', true );
89 | $this->tracking_provider_name = get_post_meta( $this->order_id, '_aftership_tracking_provider_name', true );
90 | $this->tracking_provider = get_post_meta( $this->order_id, '_aftership_tracking_provider', true );
91 |
92 | $this->tracking_url = "https://track.aftership.com/" . $this->tracking_provider . "/" . $this->tracking_code;
93 |
94 | }
95 |
96 | private function get_woocommerce_shipment_tracking() {
97 |
98 | $this->tracking_code = get_post_meta( $this->order_id, '_tracking_number', true );
99 | $this->tracking_provider_name = get_post_meta( $this->order_id, '_tracking_provider', true );
100 |
101 | $this->tracking_url = get_post_meta( $this->order_id, '_custom_tracking_link', true );
102 |
103 | }
104 |
105 | private function get_wcst_tracking() {
106 |
107 | $this->tracking_code = get_post_meta( $this->order_id, '_wcst_order_trackno', true );
108 | $this->tracking_provider_name = get_post_meta( $this->order_id, '_wcst_order_trackname', true );
109 |
110 | $this->tracking_url = get_post_meta( $this->order_id, '_wcst_order_track_http_url', true );
111 |
112 | }
113 |
114 | public function get_tracking_url() {
115 |
116 | $this->get_shipping_details();
117 |
118 | return $this->tracking_url;
119 |
120 | }
121 |
122 | }
--------------------------------------------------------------------------------
/inc/checkout-fields.php:
--------------------------------------------------------------------------------
1 | user_ref = mt_rand() . microtime();
25 | $this->user_ref = str_replace(' ', '_', $this->user_ref );
26 |
27 | $this->set_ui_settings();
28 |
29 | add_action( 'woocommerce_after_order_notes', array( &$this, 'checkout_messenger_checkbox' ) );
30 |
31 | add_action('woocommerce_checkout_update_order_meta', array( &$this, 'save_messenger_checkbox_fields' ) );
32 |
33 | }
34 |
35 |
36 | function set_ui_settings(){
37 | $prechecked = get_option( 'derweili_mbot_fb_checkbox_prechecked', 'true' );
38 | $this->checkbox_prechecked = $prechecked;
39 |
40 | $allow_login = get_option( 'derweili_mbot_fb_checkbox_allow_login', 'true' );
41 | $this->checkbox_allow_login = $allow_login;
42 |
43 | $checkbox_size = get_option( 'derweili_mbot_checkbox_size', 'large' );
44 | $this->checkbox_size = $checkbox_size;
45 |
46 | }
47 |
48 |
49 | public function checkout_messenger_checkbox( $checkout ) {
50 |
51 |
52 | $checkbox_plugin_code = '
53 |
61 | ';
62 |
63 |
64 | echo '' . __( 'Contact Options', 'mbot-woocommerce' ) . '
' . __( 'Receive updates in Messenger', 'mbot-woocommerce' ) . '' . $checkbox_plugin_code;
65 |
66 | woocommerce_form_field( 'messenger_checkbox_user_ref', array(
67 | 'type' => 'text',
68 | 'class' => array('mbot-woocommerce-hiddenfield form-row-wide'),
69 | //'label' => __('Fill in this field'),
70 | 'placeholder' => __('Enter something'),
71 | ), $this->user_ref);
72 | woocommerce_form_field( 'messenger_checkbox_user_test', array(
73 | 'type' => 'text',
74 | 'class' => array('mbot-woocommerce-hiddenfield form-row-wide'),
75 | //'label' => __('Fill in this field'),
76 | 'placeholder' => __('Enter something'),
77 | ), 'test');
78 |
79 | echo '';
80 |
81 |
82 | $this->is_checkout_page = true;
83 | }
84 |
85 |
86 | function save_messenger_checkbox_fields( $order_id ) {
87 |
88 | if ( ! empty( $_POST['messenger_checkbox_user_ref'] ) ) {
89 | update_post_meta( $order_id, 'derweili_mbot_messenger_checkbox_user_ref', $_POST['messenger_checkbox_user_ref'] );
90 | }
91 | if ( ! empty( $_POST['messenger_checkbox_user_test'] ) ) {
92 | update_post_meta( $order_id, 'derweili_mbot_messenger_checkbox_user_test', $_POST['messenger_checkbox_user_test'] );
93 | }
94 |
95 | }
96 |
97 |
98 |
99 | }
100 |
101 | new Derweili_Mbot_Checkout_Code;
--------------------------------------------------------------------------------
/inc/update.php:
--------------------------------------------------------------------------------
1 | whitelist_domain();
44 |
45 | }
46 | add_action( 'mbot_woocommerce_plugin_update', 'derweili_mbot_default_updates' );
47 |
48 |
49 |
50 | /**
51 | * NOTE: Migrate from static text to woocommerce settings
52 | * @since 1.7
53 | */
54 | function derweili_mbot_migrate_message_text( $version ) {
55 | if ( 16 >= $version ) {
56 |
57 | add_option( 'derweili_mbot_new_order_message', __( 'Thank you for your order, you will be immediately notified when your order status changes.', 'mbot-woocommerce' ) );
58 | add_option( 'derweili_mbot_pending_order_message', __( 'Your order is now pending.', 'mbot-woocommerce' ) );
59 | add_option( 'derweili_mbot_failed_order_message', __( 'Your order unfortunately failed.', 'mbot-woocommerce' ) );
60 | add_option( 'derweili_mbot_on_hold_order_message', __( 'Your order is now on hold.', 'mbot-woocommerce' ) );
61 | add_option( 'derweili_mbot_processing_order_message', __( 'Your order is now processing', 'mbot-woocommerce' ) );
62 | add_option( 'derweili_mbot_completed_order_message', __( 'Your order has been completed', 'mbot-woocommerce' ) );
63 | add_option( 'derweili_mbot_refunded_order_message', __( 'Your order has been refunded', 'mbot-woocommerce' ) );
64 | add_option( 'derweili_mbot_cancelled_order_message', __( 'Your order has been cancelled', 'mbot-woocommerce' ) );
65 |
66 |
67 | }else{
68 | }
69 | }
70 |
71 | add_action( 'mbot_woocommerce_plugin_update', 'derweili_mbot_migrate_message_text' );
72 |
73 |
74 | /**
75 | * NOTE: Migrate from static text to woocommerce settings
76 | * @since 1.17
77 | */
78 | function derweili_mbot_migrate_display_settings( $version ) {
79 | if ( 117 >= $version ) {
80 |
81 | update_option( 'derweili_mbot_checkbox_size', 'large' );
82 | update_option( 'derweili_mbot_fb_checkbox_prechecked', 'true' );
83 | update_option( 'derweili_mbot_fb_checkbox_allow_login', 'true' );
84 | update_option( 'derweili_mbot_button_size', 'large' );
85 | update_option( 'derweili_mbot_button_color', 'blue' );
86 | update_option( 'derweili_mbot_button_enforce_login', 'false' );
87 |
88 | }else{
89 | }
90 | }
91 |
92 | add_action( 'mbot_woocommerce_plugin_update', 'derweili_mbot_migrate_display_settings' );
93 |
--------------------------------------------------------------------------------
/inc/mbot-order.php:
--------------------------------------------------------------------------------
1 | order_id = $order_id;
29 |
30 | //var_dump($this->order_id);
31 |
32 | $this->get_order();
33 | $this->get_user_id();
34 | $this->is_reference();
35 | $this->init_bot();
36 |
37 | }
38 |
39 | private function get_order() {
40 |
41 | $this->order = new WC_Order( $this->order_id );
42 |
43 | }
44 |
45 | public function get_user_id() {
46 | $this->user_id = get_post_meta( $this->order_id, 'derweili_mbot_woocommerce_customer_messenger_id', true );
47 | }
48 |
49 | private function is_reference() {
50 |
51 | $this->is_reference = get_post_meta( $this->order_id, 'derweili_mbot_woocommerce_customer_ref', true );
52 |
53 | }
54 |
55 | private function init_bot() {
56 |
57 | $this->bot = new pimax\FbBotApp( mbot_woocommerce_token );
58 |
59 | }
60 |
61 | public function add_user_id( $new_user_id ) {
62 |
63 | if ( empty( $this->user_id ) ) {
64 |
65 | add_post_meta($this->order_id, 'derweili_mbot_woocommerce_customer_messenger_id', $new_user_id, true);
66 |
67 | $this->is_reference = false;
68 |
69 | $this->get_user_id();
70 |
71 | derweili_mbot_log( "New User ID " . $new_user_id . " added for Order " . $this->order_id );
72 |
73 | //file_put_contents("log2.html", 'After add user id – user id = : ' . $this->user_id, FILE_APPEND);
74 | //file_put_contents("log2.html", print_r( '
', true ), FILE_APPEND);
75 |
76 |
77 | }else{
78 |
79 | derweili_mbot_log( "Tried to add user id " . $new_user_id . " but a user ID " . $this->user_id . " already exists for order " . $this->order_id );
80 |
81 | return false;
82 |
83 | }
84 |
85 |
86 | }
87 |
88 | public function add_user_reference( $new_user_reference ) {
89 |
90 | if ( empty( $this->user_id ) ) {
91 |
92 | $this->add_user_id( $new_user_reference );
93 |
94 | add_post_meta( $this->order_id, 'derweili_mbot_woocommerce_customer_ref', true, true);
95 |
96 | $this->is_reference = true;
97 |
98 | derweili_mbot_log( "New User Reference " . $new_user_reference . " added for Order " . $this->order_id );
99 |
100 |
101 |
102 | }else{
103 |
104 | derweili_mbot_log( "Tried to add user reference " . $new_user_reference . " but a user ID " . $this->user_id . " already exists for order " . $this->order_id );
105 |
106 | return false;
107 |
108 | }
109 |
110 | }
111 |
112 | public function send_text_message( $message ) {
113 |
114 | derweili_mbot_log( 'send text message' );
115 | derweili_mbot_log( new Der_Weili_Message( $this->user_id, $message, $this->is_reference ) );
116 | return $this->bot->send( new Der_Weili_Message( $this->user_id, $message, $this->is_reference ) );
117 |
118 |
119 | }
120 |
121 | public function send_order() {
122 | derweili_mbot_log( 'send receipt' );
123 | derweili_mbot_log( new WooOrderMessage( $this->user_id, $this->order, $this->is_reference ) );
124 | return $this->bot->send(new WooOrderMessage( $this->user_id, $this->order, $this->is_reference ) );
125 | }
126 |
127 | public function send_structured_message( $data ) {
128 | derweili_mbot_log( 'send structured_message' );
129 |
130 | return $this->bot->send(
131 | new Der_Weili_Structured_Message(
132 | $this->user_id,
133 | Der_Weili_Structured_Message::TYPE_BUTTON,
134 | $data,
135 | $this->is_reference
136 | )
137 | );
138 | /*derweili_mbot_log( new WooOrderMessage( $this->user_id, $this->order, $this->is_reference ) );
139 | return $this->bot->send(new WooOrderMessage( $this->user_id, $this->order, $this->is_reference ) );*/
140 | }
141 |
142 | }
--------------------------------------------------------------------------------
/inc/domain-whitelisting.php:
--------------------------------------------------------------------------------
1 | whitelising_handler();
13 | }
14 |
15 | public function whitelising_handler() {
16 |
17 |
18 | if ( isset( $_GET["tab"]) && $_GET["tab"] == "mbot_settings" ) {
19 |
20 |
21 | $ch = curl_init();
22 |
23 | curl_setopt($ch, CURLOPT_URL,"https://graph.facebook.com/v2.6/me/thread_settings?fields=whitelisted_domains&access_token=" . mbot_woocommerce_token );
24 | curl_setopt($ch, CURLOPT_POST, 0);
25 |
26 | // receive server response ...
27 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
28 |
29 | $server_output = curl_exec ($ch);
30 |
31 | curl_close ($ch);
32 |
33 | $server_output_json = json_decode( $server_output );
34 |
35 |
36 | $whitelisted_urls = $server_output_json->data[0]->whitelisted_domains;
37 |
38 | if ( is_array( $whitelisted_urls ) ) {
39 |
40 | if ( in_array( get_home_url(), $whitelisted_urls) || in_array( 'https://' . $_SERVER['HTTP_HOST'] , $whitelisted_urls) ) {
41 | // everythin is ok
42 | }else{
43 |
44 | $this->whitelist_domain();
45 |
46 | }
47 |
48 | } // is_array
49 |
50 | }
51 |
52 | }
53 |
54 | public function get_whitelisted_domains(){
55 | $ch = curl_init();
56 |
57 | curl_setopt($ch, CURLOPT_URL,"https://graph.facebook.com/v2.6/me/thread_settings?fields=whitelisted_domains&access_token=" . mbot_woocommerce_token );
58 | curl_setopt($ch, CURLOPT_POST, 0);
59 |
60 | // receive server response ...
61 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
62 |
63 | $server_output = curl_exec ($ch);
64 |
65 | curl_close ($ch);
66 |
67 | $server_output_json = json_decode( $server_output );
68 |
69 |
70 | $whitelisted_urls = $server_output_json->data[0]->whitelisted_domains;
71 |
72 | return $whitelisted_urls;
73 |
74 | }
75 |
76 |
77 | /*
78 | * Send the Site URL to facebook as Whitelisted URL
79 | */
80 | public function whitelist_domain( $action_type = 'add' ) {
81 | $ch = curl_init();
82 |
83 | $post_params = array(
84 | 'setting_type' => 'domain_whitelisting',
85 | 'whitelisted_domains' => array( get_home_url(), 'https://' . $_SERVER['HTTP_HOST'] ),
86 | 'domain_action_type' => $action_type,
87 | );
88 |
89 | $post_params = http_build_query( $post_params );
90 |
91 | curl_setopt($ch, CURLOPT_URL,"https://graph.facebook.com/v2.6/me/thread_settings?access_token=" . mbot_woocommerce_token );
92 | curl_setopt($ch, CURLOPT_POST, 1);
93 | curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params );
94 |
95 |
96 |
97 | // receive server response ...
98 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
99 |
100 | $server_output = curl_exec ($ch);
101 |
102 | curl_close ($ch);
103 |
104 |
105 | }
106 |
107 |
108 | }
109 |
110 | function derweili_mbot_standard_domain_whitelisting() {
111 |
112 | new Derweili_Mbot_Domain_Whitelisting();
113 |
114 | }
115 |
116 | add_action ( "admin_head", "derweili_mbot_standard_domain_whitelisting" );
117 |
118 |
119 |
120 | function derweili_get_whitelisted_domains(){
121 | $whitelisting = new Derweili_Mbot_Domain_Whitelisting();
122 |
123 | $output = '';
124 | $whitelisted_domains = $whitelisting->get_whitelisted_domains();
125 | if ( is_array( $whitelisted_domains ) ) {
126 | foreach ( $whitelisted_domains as $domain) {
127 | $output .= $domain . ' ';
128 | }
129 | }
130 | return $output;
131 | };
--------------------------------------------------------------------------------
/inc/woocommerce-thank-you.php:
--------------------------------------------------------------------------------
1 | set_ui_settings();
30 |
31 | // place messenger script into footer
32 | add_action('derweili_mbot_after_fb_init', array( &$this, 'woocommerce_thank_you_script' ), 10);
33 | }
34 |
35 | // handle send-to-messenger style attributes
36 | function set_ui_settings(){
37 |
38 | $buttom_size = get_option( 'derweili_mbot_button_size', 'large' );
39 | $this->buttom_size = $buttom_size;
40 |
41 |
42 | $button_color = get_option( 'derweili_mbot_button_color', 'blue' );
43 | $this->button_color = $button_color;
44 |
45 |
46 | $button_enforce_login = get_option( 'derweili_mbot_button_enforce_login', 'false' );
47 | $this->button_enforce_login = $button_enforce_login;
48 |
49 |
50 | }
51 |
52 |
53 | // check if user checked the checkbox plugin
54 | // display send to messenger plugin if checkbox has not been checked
55 | function woocommerce_thank_you_message( $example, $order ) {
56 |
57 | //get messenger id from user
58 | $messenger_checkbox_user_ref = get_post_meta( $order->id, 'derweili_mbot_messenger_checkbox_user_ref', true );
59 | $messenger_checkbox_checked = get_post_meta( $order->id, 'derweili_mbot_messenger_checkbox_user_test', true );
60 | $this->messenger_checkbox = $messenger_checkbox_checked;
61 | $this->messenger_checkbox_user_ref = $messenger_checkbox_user_ref;
62 | $this->order_id = $order->id;
63 |
64 | if ( !empty( $messenger_checkbox_user_ref ) && !empty( $messenger_checkbox_checked ) && 'checked' == $messenger_checkbox_checked ) {
65 |
66 | return $example;
67 |
68 | }else{
69 |
70 | return $this->display_send_to_messenger_button( $example, $order );
71 |
72 | }
73 | }
74 |
75 |
76 | // send user confirmation if user checked the checkbox plugin on checkout page
77 | function woocommerce_thank_you_script(){ ?>
78 |
79 |
80 | messenger_checkbox) {
84 |
85 | derweili_mbot_log( 'Load user checkbox confirmation script for order ' . $this->order_id );
86 |
87 | echo "FB.AppEvents.logEvent('MessengerCheckboxUserConfirmation', null, {
88 | 'app_id':'" . mbot_woocommerce_app_id . "',
89 | 'page_id':'" . mbot_woocommerce_page_id . "',
90 | 'ref':'derweiliSubscribeToOrder" . $this->order_id . "',
91 | 'user_ref':'" . $this->messenger_checkbox_user_ref . "'
92 | });";
93 |
94 | }
95 | ?>
96 |
97 |
98 | id );
104 |
105 | $send_to_messenger_button = '';
112 | return '' . __( 'Get notified about Updates via Facebook Messenger', 'mbot-woocommerce' ) . '
' . $send_to_messenger_button . '' . $example;
113 |
114 | }
115 |
116 | }
117 |
118 | new Derweili_Mbot_Thank_You_Page;
--------------------------------------------------------------------------------
/vendor/fb-messenger-php/FbBotApp.php:
--------------------------------------------------------------------------------
1 | token = $token;
49 | }
50 |
51 | /**
52 | * Send Message
53 | *
54 | * @param Message $message
55 | * @return array
56 | */
57 | public function send($message)
58 | {
59 | return $this->call('me/messages', $message->getData());
60 | }
61 |
62 | /**
63 | * Get User Profile Info
64 | *
65 | * @param int $id
66 | * @param string $fields
67 | * @return UserProfile
68 | */
69 | public function userProfile($id, $fields = 'first_name,last_name,profile_pic,locale,timezone,gender')
70 | {
71 | return new UserProfile($this->call($id, [
72 | 'fields' => $fields
73 | ], self::TYPE_GET));
74 | }
75 |
76 | /**
77 | * Set Persistent Menu
78 | *
79 | * @see https://developers.facebook.com/docs/messenger-platform/thread-settings/persistent-menu
80 | * @param MessageButton[] $buttons
81 | * @return array
82 | */
83 | public function setPersistentMenu($buttons)
84 | {
85 | $elements = [];
86 |
87 | foreach ($buttons as $btn) {
88 | $elements[] = $btn->getData();
89 | }
90 |
91 | return $this->call('me/thread_settings', [
92 | 'setting_type' => 'call_to_actions',
93 | 'thread_state' => 'existing_thread',
94 | 'call_to_actions' => $elements
95 | ], self::TYPE_POST);
96 | }
97 |
98 | /**
99 | * Remove Persistent Menu
100 | *
101 | * @see https://developers.facebook.com/docs/messenger-platform/thread-settings/persistent-menu
102 | * @return array
103 | */
104 | public function deletePersistentMenu()
105 | {
106 | return $this->call('me/thread_settings', [
107 | 'setting_type' => 'call_to_actions',
108 | 'thread_state' => 'existing_thread'
109 | ], self::TYPE_DELETE);
110 | }
111 |
112 | /**
113 | * Request to API
114 | *
115 | * @param string $url
116 | * @param array $data
117 | * @param string $type Type of request (GET|POST|DELETE)
118 | * @return array
119 | */
120 | protected function call($url, $data, $type = self::TYPE_POST)
121 | {
122 | $data['access_token'] = $this->token;
123 |
124 | $headers = [
125 | 'Content-Type: application/json',
126 | ];
127 |
128 | if ($type == self::TYPE_GET) {
129 | $url .= '?'.http_build_query($data);
130 | }
131 |
132 | $process = curl_init($this->apiUrl.$url);
133 | curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
134 | curl_setopt($process, CURLOPT_HEADER, false);
135 | curl_setopt($process, CURLOPT_TIMEOUT, 30);
136 |
137 | if($type == self::TYPE_POST || $type == self::TYPE_DELETE) {
138 | curl_setopt($process, CURLOPT_POST, 1);
139 | curl_setopt($process, CURLOPT_POSTFIELDS, http_build_query($data));
140 | }
141 |
142 | if ($type == self::TYPE_DELETE) {
143 | curl_setopt($process, CURLOPT_CUSTOMREQUEST, "DELETE");
144 | }
145 |
146 | curl_setopt($process, CURLOPT_RETURNTRANSFER, true);
147 | $return = curl_exec($process);
148 | curl_close($process);
149 |
150 | return json_decode($return, true);
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/inc/derweili-structured-message.php:
--------------------------------------------------------------------------------
1 | recipient_type = 'user_ref';
31 |
32 | $this->recipient = $recipient;
33 | $this->type = $type;
34 |
35 | switch ($type)
36 | {
37 | case self::TYPE_BUTTON:
38 | $this->title = $data['text'];
39 | $this->buttons = $data['buttons'];
40 | break;
41 |
42 | case self::TYPE_GENERIC:
43 | $this->elements = $data['elements'];
44 | break;
45 |
46 | case self::TYPE_RECEIPT:
47 | $this->recipient_name = $data['recipient_name'];
48 | $this->order_number = $data['order_number'];
49 | $this->currency = $data['currency'];
50 | $this->payment_method = $data['payment_method'];
51 | $this->order_url = $data['order_url'];
52 | $this->timestamp = $data['timestamp'];
53 | $this->elements = $data['elements'];
54 | $this->address = $data['address'];
55 | $this->summary = $data['summary'];
56 | $this->adjustments = $data['adjustments'];
57 | break;
58 | }
59 | }
60 |
61 | /**
62 | * Get Data
63 | *
64 | * @return array
65 | */
66 | public function getData()
67 | {
68 | $result = [
69 | 'attachment' => [
70 | 'type' => 'template',
71 | 'payload' => [
72 | 'template_type' => $this->type
73 | ]
74 | ]
75 | ];
76 |
77 | switch ($this->type)
78 | {
79 | case self::TYPE_BUTTON:
80 | $result['attachment']['payload']['text'] = $this->title;
81 | $result['attachment']['payload']['buttons'] = [];
82 |
83 | foreach ($this->buttons as $btn) {
84 | $result['attachment']['payload']['buttons'][] = $btn->getData();
85 | }
86 |
87 | break;
88 |
89 | case self::TYPE_GENERIC:
90 | $result['attachment']['payload']['elements'] = [];
91 |
92 | foreach ($this->elements as $btn) {
93 | $result['attachment']['payload']['elements'][] = $btn->getData();
94 | }
95 | break;
96 |
97 | case self::TYPE_RECEIPT:
98 | $result['attachment']['payload']['recipient_name'] = $this->recipient_name;
99 | $result['attachment']['payload']['order_number'] = $this->order_number;
100 | $result['attachment']['payload']['currency'] = $this->currency;
101 | $result['attachment']['payload']['payment_method'] = $this->payment_method;
102 | $result['attachment']['payload']['order_url'] = $this->order_url;
103 | $result['attachment']['payload']['timestamp'] = $this->timestamp;
104 | $result['attachment']['payload']['elements'] = [];
105 |
106 | foreach ($this->elements as $btn) {
107 | $result['attachment']['payload']['elements'][] = $btn->getData();
108 | }
109 |
110 | $result['attachment']['payload']['address'] = $this->address->getData();
111 | $result['attachment']['payload']['summary'] = $this->summary->getData();
112 | $result['attachment']['payload']['adjustments'] = [];
113 |
114 | foreach ($this->adjustments as $btn) {
115 | $result['attachment']['payload']['adjustments'][] = $btn->getData();
116 | }
117 | break;
118 | }
119 |
120 | $this->get_data_return['message'] = $result;
121 | $this->get_data_return['recipient'] = array();
122 | $this->get_data_return['recipient'][$this->recipient_type] = $this->recipient;
123 |
124 |
125 |
126 | return $this->get_data_return;
127 | }
128 | }
--------------------------------------------------------------------------------
/inc/order-status-action-manager.php:
--------------------------------------------------------------------------------
1 | get_custom_order_status();
19 | $this->register_custom_order_status_messages();
20 |
21 |
22 | }
23 |
24 |
25 | function get_custom_order_status(){
26 | $args = array(
27 | 'posts_per_page' => -1,
28 | 'post_type' => 'wc_custom_statuses',
29 | 'post_status' => 'publish',
30 | );
31 | $custom_order_statuses_objects = get_posts( $args );
32 |
33 | foreach ($custom_order_statuses_objects as $status) {
34 |
35 | $label = get_post_meta( $status->ID, '__label', true );
36 |
37 | $this->custom_order_status[$label] = array(
38 | 'label' => $label,
39 | 'title' => $status->post_title,
40 | 'message' => get_post_meta( $status->ID, '_derweili_mbot_custom_status_message', true ),
41 | 'ID' => $status->ID,
42 |
43 | );
44 | }
45 | //derweili_mbot_log($this->custom_order_status);
46 |
47 | }
48 |
49 | // Add Metabox for Custom Order Status Post type
50 | public function add_custom_order_status_messengerbot_metabox(){
51 |
52 | add_meta_box('custom_order_status_messengerbot_message', __('Messenger Bot', 'mbot-woocommerce'), array( &$this, 'custom_order_status_messengerbot_metabox_content'), 'wc_custom_statuses', 'normal', 'default');
53 | }
54 |
55 | public function custom_order_status_messengerbot_metabox_content(){
56 | global $post;
57 |
58 | // Noncename needed to verify where the data originated
59 | echo '';
61 |
62 | // Get the location data if its already been entered
63 | $location = get_post_meta($post->ID, '_derweili_mbot_custom_status_message', true);
64 |
65 | // Echo out the field
66 | echo '';
67 |
68 | }
69 |
70 |
71 |
72 | // Save the Metabox Data
73 |
74 | public function save_custom_order_status_messengerbot_metabox($post_id, $post) {
75 |
76 | // verify this came from the our screen and with proper authorization,
77 | // because save_post can be triggered at other times
78 | /*if ( !wp_verify_nonce( $_POST['derweili_mbot_custom_status_noncename'], plugin_basename(__FILE__) )) {
79 | return $post->ID;
80 | }*/
81 |
82 | // Is the user allowed to edit the post or page?
83 | if ( !current_user_can( 'edit_post', $post->ID ))
84 | return $post->ID;
85 |
86 | // OK, we're authenticated: we need to find and save the data
87 | // We'll put it into an array to make it easier to loop though.
88 |
89 | $events_meta['_derweili_mbot_custom_status_message'] = $_POST['_derweili_mbot_custom_status_message'];
90 |
91 | // Add values of $events_meta as custom fields
92 |
93 | foreach ($events_meta as $key => $value) { // Cycle through the $events_meta array!
94 |
95 | if( $post->post_type == 'revision' ) return; // Don't store custom data twice
96 |
97 | if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value
98 | update_post_meta($post->ID, $key, $value);
99 | } else { // If the custom field doesn't have a value
100 | add_post_meta($post->ID, $key, $value);
101 | }
102 | if(!$value) delete_post_meta($post->ID, $key); // Delete if blank
103 | }
104 |
105 | }
106 |
107 |
108 | public function register_custom_order_status_messages() {
109 | foreach ($this->custom_order_status as $key => $value) {
110 | add_action( 'woocommerce_order_status_' . $key, array( &$this, 'derweili_mbot_woocommerce_orderstatus_custom' ) );
111 | }
112 | }
113 |
114 | public function derweili_mbot_woocommerce_orderstatus_custom( $order_id ) {
115 |
116 |
117 | $order = new Derweili_Mbot_Order( $order_id );
118 |
119 | $order_status = $order->order->get_status();
120 |
121 | if ( array_key_exists( $order_status, $this->custom_order_status)) {
122 |
123 | if ( ! empty( $this->custom_order_status[$order_status]['message'] )) {
124 | $order->send_text_message( $this->custom_order_status[$order_status]['message'] );
125 | }
126 |
127 | }
128 |
129 |
130 |
131 |
132 |
133 | }
134 |
135 |
136 |
137 | }
138 |
139 | new Derweili_Custom_Order_Status_Handler();
--------------------------------------------------------------------------------
/readme.txt:
--------------------------------------------------------------------------------
1 | === Messengerbot for WooCommerce ===
2 | Contributors: derweili
3 | Donate link: http://derweili.de/
4 | Tags: facebook, woocommerce, messenger
5 | Requires at least: 4.6
6 | Tested up to: 4.7
7 | Stable tag: 1.22
8 | License: GPLv3
9 | License URI: https://www.gnu.org/licenses/gpl-3.0.html
10 |
11 | Send order summaries and notices to your WooCommerce customers via Facebook Messenger API
12 |
13 | == Description ==
14 |
15 | This Plugin gives you the ability to send your customers order notifications via the Facebook Messenger API.
16 |
17 | Following Messages are supported:
18 |
19 | * [Order Receipts](https://developers.facebook.com/docs/messenger-platform/send-api-reference/receipt-template, "Facebook Documentation")
20 | * Order status changes
21 | * Customer Order notes
22 | * Tracking information for [AfterShip Tracking Plugin](https://de.wordpress.org/plugins/aftership-woocommerce-tracking/) and "WooCommerce Shipping Tracking"
23 |
24 |
25 | == Installation ==
26 |
27 | 1. Upload the plugin files to the `/wp-content/plugins/fb-messenger-bot-for-woocomemrce` directory, or install the plugin through the WordPress plugins screen directly.
28 | 2. Activate the plugin through the 'Plugins' screen in WordPress
29 |
30 | == Frequently Asked Questions ==
31 |
32 | = How do I configure the plugin =
33 |
34 | You can find the plugin settings screen here:
35 | WooCommerce->Settings->Messenger Bot
36 |
37 | To Configure the plugin follow theese steps
38 |
39 | 1. Go to https://developers.facebook.com/apps/ and add an new app (or use an existing one)
40 | 1.1 Store the App ID on the Plugins Settings Page
41 | 2. Got to your Facebook App Settings and fill out the forms
42 | 3. Add "Messenger" as a Product
43 | 3. Get the Page Access Token:
44 | 3.1. Go to the "Token Generation" section on the Products->Messenger Screen.
45 | 3.2. Select the Page you want to use
46 | 3.3. Take the Access token you get and save it
47 | 4. Set up the webhook
48 | 4.1. Add a webhook to you Facebook App: Add Product -> Webhooks -> Get started
49 | 4.2. Add a Subscription: New Subsciption-> Page
50 | 4.3. Fill out the Callback URL. You can find you callback url within the Plugin Settings screen
51 | 4.4. Save a custom Verify Token on the plugin settings screen
52 | 4.5. Paste this custom verify token in the webhook screen on facebook.
53 | 4.6. Check following Subscription Fields: message_delivery, messages, message_account_linking, message_optins, messaging_postbacks
54 | 4.7. Click "Verify and Safe"
55 |
56 | 5. You have finished. Well done!
57 |
58 | = Why are the messenger checkbox and send to messenger button not displayed? =
59 |
60 | If your FB-App is in development mode (The review process hasn't finished) only the FB-App Developers can see the Buttons while they are logged in into their Facebook Account.
61 |
62 | = I still can't see the checkbox and send to Messenger Button =
63 |
64 | Please go to the Plugin settings and resave the API Credentials. In most cases this solves the problem. Check if your url is show in the list of whitelisted domains (on the top of the plugin settings page)
65 |
66 | = The Callback verification failed with HTTP Status Code 404 =
67 |
68 | Go to Settings > Permalink and resave the Permalink settings. After this, try again.
69 |
70 | = Where can I report bugs? =
71 |
72 | Please open an issue on [Github](https://github.com/derweili/fb-messenger-bot-for-woocommerce, "Github") if you found a bug:
73 | https://github.com/derweili/fb-messenger-bot-for-woocommerce
74 |
75 | == Screenshots ==
76 |
77 | 1. **Plugin Settings Screen**
78 |
79 | == Changelog ==
80 |
81 | = 1.22 =
82 | * Performance improvements: load Facebook JS SDK only on checkout pages
83 |
84 |
85 | = 1.16 =
86 | * Additional Settings Section for appearance settings added
87 |
88 |
89 | = 1.16 =
90 | * Support for [WooCommerce Order Status & Actions Manager
91 | ](https://codecanyon.net/item/woocommerce-order-status-actions-manager/6392174) added
92 |
93 | = 1.15 =
94 | * Support for [AfterShip Tracking Plugin](https://de.wordpress.org/plugins/aftership-woocommerce-tracking/) added
95 | * Support for WooCommerce Shipping Tracking added
96 | * tax is now added to items when tax_display_cart option is set to „incl“
97 |
98 | = 1.13 =
99 | * Feature: The Facebook Plugins are now loaded in the correct language (if available)
100 |
101 | = 1.11 =
102 | * Feature: Settings page refactored
103 | * Feature: Tutorial for Settings Page added
104 |
105 |
106 | = 1.7 =
107 | * Feature: The messages send to the users can now be edited via the plugin settings.
108 |
109 | = 1.5 =
110 | * Bugfix: Domain Whitelisting failed while WordPress is installed in subdirectory
111 |
112 | = 1.1 =
113 | * Added: Error log for Webhook Calls when WP_DEBUG is enabled
114 |
115 |
116 | = 1.1 =
117 | * Webhook function refactored to match WordPress plugin directory guidelines
118 |
119 | = 1.0 =
120 | * Initial Plugin Setup
121 |
--------------------------------------------------------------------------------
/inc/guide.php:
--------------------------------------------------------------------------------
1 |
72 |
73 |
74 |
Facebook Page ID
75 |
You can find your Page ID on your Facebook Page in the "About Section"
76 |
 ) . )
/img/guide/page-id.png" alt="Page ID" width="100%">
77 |
78 |
79 |
80 |
Facebook App ID
81 |
1. Creat an App here…
82 |
2. Choose Basic Setup
83 |
 ) . )
/img/guide/choose-app-setup.png" alt="Choose Setup" width="100%">
84 |
85 |
3. Give you App a name, a contact mail and a choose a category e.g. "App for Messenger"
86 |
 ) . )
/img/guide/create-app-form.png" alt="Create App Form" width="100%">
87 |
88 |
You can find you App ID in the upper left corner of the App Setting Screen.
89 |
 ) . )
/img/guide/app-id.png" alt="Create App Form" width="100%">
90 |
91 |
92 |
93 |
Facebook Page Token
94 |
1. Open You Facebook App Settings
95 |
2. Go To "Products">"Settings">"Token Generation"
96 |
3. Choose your Page
97 |
4. You will get a Token for you page
98 |
99 |
 ) . )
/img/guide/page-token.png" alt="Choose Setup" width="100%">
100 |
101 |
102 |
103 | Need Help? Start the Tutorial
104 |
105 | send_text_message( get_option( 'derweili_mbot_pending_order_message' ) );
40 |
41 | }
42 |
43 | public function derweili_mbot_woocommerce_orderstatus_message_failed( $order_id ) {
44 |
45 | derweili_mbot_log( 'Send order status notification for failed order.' );
46 |
47 | $order = new Derweili_Mbot_Order( $order_id );
48 | $order->send_text_message( get_option( 'derweili_mbot_failed_order_message' ) );
49 |
50 | }
51 |
52 |
53 | public function derweili_mbot_woocommerce_orderstatus_message_hold( $order_id ) {
54 |
55 | derweili_mbot_log( 'Send order status notification for status "on hold".' );
56 |
57 | $order = new Derweili_Mbot_Order( $order_id );
58 | $order->send_text_message( get_option( 'derweili_mbot_on_hold_order_message' ) );
59 |
60 | }
61 |
62 |
63 | public function derweili_mbot_woocommerce_orderstatus_message_processing( $order_id ) {
64 |
65 | derweili_mbot_log( 'Send order status notification for status "processing".' );
66 |
67 | $order = new Derweili_Mbot_Order( $order_id );
68 | $order->send_text_message( get_option( 'derweili_mbot_new_order_message' ) );
69 |
70 | }
71 |
72 |
73 | public function derweili_mbot_woocommerce_orderstatus_message_completed( $order_id ) {
74 |
75 | derweili_mbot_log( 'Send order status notification for completed order.' );
76 |
77 | $order = new Derweili_Mbot_Order( $order_id );
78 |
79 | $shipping = new Derweili_Order_Shipping_Handler( $order_id );
80 | if ( $shipping->has_shipping() ) {
81 | $order->send_structured_message(
82 | [
83 | 'text' => get_option( 'derweili_mbot_completed_order_message' ),
84 | 'buttons' => [
85 | new pimax\Messages\MessageButton(
86 | pimax\Messages\MessageButton::TYPE_WEB,
87 | __( 'View Tracking', 'mbot-woocommmerce' ),
88 | $shipping->get_tracking_url()
89 | )
90 | /*new MessageButton(MessageButton::TYPE_POSTBACK, 'Second button'),
91 | new MessageButton(MessageButton::TYPE_POSTBACK, 'Third button')*/
92 | ]
93 | ]
94 | );
95 | }else{
96 | $order->send_text_message( get_option( 'derweili_mbot_completed_order_message' ) );
97 | }
98 |
99 | }
100 |
101 |
102 | public function derweili_mbot_woocommerce_orderstatus_message_refunded($order_id) {
103 |
104 | derweili_mbot_log( 'Send order status notification for refunded order.' );
105 |
106 | $order = new Derweili_Mbot_Order( $order_id );
107 | $order->send_text_message( get_option( 'derweili_mbot_refunded_order_message' ) );
108 |
109 | }
110 |
111 |
112 | public function derweili_mbot_woocommerce_orderstatus_message_cancelled( $order_id ) {
113 |
114 | derweili_mbot_log( 'Send order status notification for cancelled order.' );
115 |
116 | $order = new Derweili_Mbot_Order( $order_id );
117 | $order->send_text_message( get_option( 'derweili_mbot_cancelled_order_message' ) );
118 |
119 | }
120 |
121 |
122 | public function derweili_mbot_woocommerce_new_order_note() {
123 |
124 | if ( isset( $_POST['post_id'] ) && isset( $_POST['note'] ) && isset( $_POST['note_type'] ) && 'customer' == $_POST['note_type'] ) {
125 |
126 | if ( current_user_can( 'manage_woocommerce' ) ) { // check if user can manage orders
127 |
128 | derweili_mbot_log( 'Send order note to customer.' );
129 |
130 | $order = new Derweili_Mbot_Order( intval( $_POST['post_id'] ) );
131 | $order->send_text_message( $_POST['note'] );
132 |
133 | }
134 |
135 | }
136 | }
137 |
138 | }
139 |
140 | new DERWEILI_STATUS_UPDATE_MESSAGES;
--------------------------------------------------------------------------------
/mbot-woocommerce.php:
--------------------------------------------------------------------------------
1 | load_vendors();
35 | $this->define_credentials();
36 |
37 |
38 | if ( $this->credentials_not_empty() ) {
39 | $this->load_dependencies();
40 | }
41 |
42 | add_action( 'admin_init', array( &$this, 'load_admin_dependencies' ) );
43 | add_action( 'init', array( &$this, 'load_text_domain' ) );
44 | add_action( 'wp_head', array( &$this, 'inline_css' ) );
45 | register_activation_hook( dirname( __FILE__ ) . '/install.php', 'mbot_install_mbot' );
46 |
47 | }
48 |
49 | // include php messenger sdk
50 | private function load_vendors() {
51 |
52 | include('vendor/fb-messenger-php/FbBotApp.php');
53 | include('vendor/fb-messenger-php/Messages/Message.php');
54 | include('vendor/fb-messenger-php/Messages/MessageButton.php');
55 | include('vendor/fb-messenger-php/Messages/StructuredMessage.php');
56 | include('vendor/fb-messenger-php/Messages/MessageElement.php');
57 | include('vendor/fb-messenger-php/Messages/MessageReceiptElement.php');
58 | include('vendor/fb-messenger-php/Messages/Address.php');
59 | include('vendor/fb-messenger-php/Messages/Summary.php');
60 | include('vendor/fb-messenger-php/Messages/Adjustment.php');
61 |
62 | }
63 |
64 | // Save credentials in php constants
65 | private function define_credentials() {
66 |
67 | //Define Messenger App Token
68 | define( "mbot_woocommerce_token", get_option( 'derweili_mbot_page_token' ) );
69 |
70 | //Define Webhook Verify Token
71 | define("mbot_woocommerce_verify_token", get_option( 'derweili_mbot_verify_token' ) );
72 |
73 | //Define Messenger App ID
74 | define("mbot_woocommerce_app_id", get_option( 'derweili_mbot_messenger_app_id' ) );
75 |
76 | //Define Page ID
77 | define("mbot_woocommerce_page_id", get_option( 'derweili_mbot_page_id' ) );
78 |
79 | }
80 |
81 | // function to check if credentials are stored and available
82 | private function credentials_not_empty() {
83 | if ( !empty( mbot_woocommerce_token ) && !empty( mbot_woocommerce_verify_token ) && !empty( mbot_woocommerce_app_id ) && !empty( mbot_woocommerce_page_id ) ){
84 |
85 | define( 'mbot_credentials_defined', true);
86 |
87 | return true;
88 | }else{
89 |
90 | define( 'mbot_credentials_defined', false);
91 |
92 | return false;
93 | }
94 | }
95 |
96 |
97 | // load other dependencies
98 | private function load_dependencies() {
99 |
100 | include('inc/error-log.php');
101 | include('inc/WooOrderMessage.php');
102 | include('inc/derweili-message.php');
103 | include('inc/derweili-structured-message.php');
104 | include('inc/woocommerce-thank-you.php');
105 | include('inc/filter-functions.php');
106 | include('inc/checkout-fields.php');
107 | include('inc/mbot-order.php');
108 | include('inc/footer-script.php');
109 | include('inc/shipping.php');
110 |
111 | include('inc/webhook-setup.php');
112 | include('webhook.php');
113 |
114 | }
115 |
116 | public function load_admin_dependencies() {
117 |
118 | include('inc/woocommerce-order-status-messages.php');
119 | include('inc/settingspage.php');
120 | include('inc/domain-whitelisting.php');
121 | include('inc/update.php');
122 | include('inc/guide.php');
123 | include('inc/order-status-action-manager.php');
124 |
125 | add_filter( 'woocommerce_get_settings_pages', array( &$this, 'load_wc_settings' ) ); // Add Settings Page
126 |
127 |
128 | }
129 |
130 | public function load_wc_settings( $settings ){
131 | $settings[] = include( 'inc/wc-plugin-settings.php' );
132 | return $settings;
133 | }
134 |
135 | public function load_filter_functions() {
136 |
137 | include('inc/filter-functions.php');
138 |
139 |
140 | }
141 |
142 | /**
143 | * Load plugin textdomain.
144 | *
145 | * @since 1.0.0
146 | */
147 | public function load_text_domain() {
148 | //load_plugin_textdomain( 'mbot-woocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
149 |
150 | $domain = 'mbot-woocommerce';
151 | $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
152 | // wp-content/languages/plugin-name/plugin-name-de_DE.mo
153 | load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
154 | // wp-content/plugins/plugin-name/languages/plugin-name-de_DE.mo
155 | load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
156 |
157 | }
158 |
159 | public function inline_css() {
160 | ?>
161 |
162 | recipient = $recipient;
112 | $this->type = $type;
113 |
114 | switch ($type)
115 | {
116 | case self::TYPE_BUTTON:
117 | $this->title = $data['text'];
118 | $this->buttons = $data['buttons'];
119 | break;
120 |
121 | case self::TYPE_GENERIC:
122 | $this->elements = $data['elements'];
123 | break;
124 |
125 | case self::TYPE_RECEIPT:
126 | $this->recipient_name = $data['recipient_name'];
127 | $this->order_number = $data['order_number'];
128 | $this->currency = $data['currency'];
129 | $this->payment_method = $data['payment_method'];
130 | $this->order_url = $data['order_url'];
131 | $this->timestamp = $data['timestamp'];
132 | $this->elements = $data['elements'];
133 | $this->address = $data['address'];
134 | $this->summary = $data['summary'];
135 | $this->adjustments = $data['adjustments'];
136 | break;
137 | }
138 | }
139 |
140 | /**
141 | * Get Data
142 | *
143 | * @return array
144 | */
145 | public function getData()
146 | {
147 | $result = [
148 | 'attachment' => [
149 | 'type' => 'template',
150 | 'payload' => [
151 | 'template_type' => $this->type
152 | ]
153 | ]
154 | ];
155 |
156 | switch ($this->type)
157 | {
158 | case self::TYPE_BUTTON:
159 | $result['attachment']['payload']['text'] = $this->title;
160 | $result['attachment']['payload']['buttons'] = [];
161 |
162 | foreach ($this->buttons as $btn) {
163 | $result['attachment']['payload']['buttons'][] = $btn->getData();
164 | }
165 |
166 | break;
167 |
168 | case self::TYPE_GENERIC:
169 | $result['attachment']['payload']['elements'] = [];
170 |
171 | foreach ($this->elements as $btn) {
172 | $result['attachment']['payload']['elements'][] = $btn->getData();
173 | }
174 | break;
175 |
176 | case self::TYPE_RECEIPT:
177 | $result['attachment']['payload']['recipient_name'] = $this->recipient_name;
178 | $result['attachment']['payload']['order_number'] = $this->order_number;
179 | $result['attachment']['payload']['currency'] = $this->currency;
180 | $result['attachment']['payload']['payment_method'] = $this->payment_method;
181 | $result['attachment']['payload']['order_url'] = $this->order_url;
182 | $result['attachment']['payload']['timestamp'] = $this->timestamp;
183 | $result['attachment']['payload']['elements'] = [];
184 |
185 | foreach ($this->elements as $btn) {
186 | $result['attachment']['payload']['elements'][] = $btn->getData();
187 | }
188 |
189 | $result['attachment']['payload']['address'] = $this->address->getData();
190 | $result['attachment']['payload']['summary'] = $this->summary->getData();
191 | $result['attachment']['payload']['adjustments'] = [];
192 |
193 | foreach ($this->adjustments as $btn) {
194 | $result['attachment']['payload']['adjustments'][] = $btn->getData();
195 | }
196 | break;
197 | }
198 |
199 | return [
200 | 'recipient' => [
201 | 'id' => $this->recipient
202 | ],
203 | 'message' => $result
204 | ];
205 | }
206 | }
--------------------------------------------------------------------------------
/webhook.php:
--------------------------------------------------------------------------------
1 | ', true ), FILE_APPEND);
21 |
22 | //Chef if something is received
23 | if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] == 'subscribe' && $_REQUEST['hub_verify_token'] == mbot_woocommerce_verify_token) {
24 |
25 | // Webhook setup request
26 | //file_put_contents("log.html", $_REQUEST['hub_challenge']);
27 | echo $_REQUEST['hub_challenge'];
28 |
29 | derweili_mbot_log( "Webhook setup request received" );
30 |
31 | } else {
32 |
33 | derweili_mbot_log( "MBot Other request reveived" );
34 |
35 | // Other event
36 | $data = json_decode(file_get_contents("php://input"), true);
37 |
38 | derweili_mbot_log( "Webhook Data" );
39 |
40 | derweili_mbot_log( $data );
41 |
42 | // Log Webhook Calls if wp_debug is turned on
43 | if (defined('WP_DEBUG') && true === WP_DEBUG) {
44 | //Log latest connections
45 | $logdata = print_r($data['entry'], true);
46 |
47 | //file_put_contents("log.html", '
', FILE_APPEND);
48 | //file_put_contents("log.html", $logdata, FILE_APPEND);
49 |
50 | }
51 |
52 |
53 | if (!empty($data['entry'][0]['messaging'])) {
54 |
55 | derweili_mbot_log( "Webhook Call contains " . count( $data['entry'][0]['messaging'] ) . " message/s." );
56 |
57 | foreach ($data['entry'][0]['messaging'] as $message) {
58 |
59 |
60 | $command = "";
61 |
62 | //If Authentication Callback is received
63 | if ( !empty( $message['optin'] ) ) {
64 |
65 | derweili_mbot_log( "Optin message detected" );
66 |
67 | //$bot->send( new pimax\Messages\Message( $message['sender']['id'], 'Optin, sender id: ' . $message['sender']['id'] ) );
68 |
69 | //Is order subsciption
70 | if (derweili_mbot_woocommerce_startswith($message['optin']['ref'], 'derweiliSubscribeToOrder' )) {
71 |
72 | $orderid = str_replace("derweiliSubscribeToOrder", "", $message['optin']['ref']);
73 | $mbot_Order = new Derweili_Mbot_Order($orderid);
74 |
75 |
76 |
77 | // store user messenger id as post meta
78 | if ( isset( $message['sender']['id'] ) ) {
79 |
80 | derweili_mbot_log( "Sender Id is " . $message['sender']['id'] );
81 |
82 | $mbot_Order->add_user_id($message['sender']['id']);
83 |
84 | //add_post_meta($orderid, 'derweili_mbot_woocommerce_customer_messenger_id', $message['sender']['id'], true);
85 | //$receiver_id = $message['sender']['id'];
86 | }elseif ( isset( $message['optin']['user_ref'] ) ){
87 |
88 | $mbot_Order->add_user_reference( $message['optin']['user_ref'] );
89 |
90 | derweili_mbot_log( "User Referece is " . $message['optin']['user_ref'] );
91 |
92 | // add_post_meta($orderid, 'derweili_mbot_woocommerce_customer_messenger_id', $message['optin']['user_ref'], true);
93 | // add_post_meta($orderid, 'derweili_mbot_woocommerce_customer_ref', true, true);
94 | // $receiver_id = $message['optin']['user_ref'];
95 | }
96 |
97 | // store user messenger id as user meta
98 | /* if ($order->get_user_id() != 0) {
99 | //add_user_meta( $order->get_user_id(), 'derweili_mbot_woocommerce_messenger_id', $message['sender']['id'], true );
100 | }*/
101 |
102 | //send text message to messenger
103 | $sendmessage = $mbot_Order->send_text_message( get_site_option( 'derweili_mbot_new_order_message' ) );
104 | //$bot->send( new Der_Weili_Message( $receiver_id, __('Thank you for your order, you will be immediately notified when your order status changes.', 'mbot-woocommerce') ) );
105 | //send Order notification to messenger
106 | //$bot->send(new WooOrderMessage( $receiver_id, $order ) );
107 |
108 | //file_put_contents("log2.html", print_r( $sendmessage, true ), FILE_APPEND);
109 | //file_put_contents("log2.html", print_r( '
', true ), FILE_APPEND);
110 |
111 | $receipt_send_return = $mbot_Order->send_order();
112 | derweili_mbot_log( "Order Sent" );
113 | derweili_mbot_log( $receipt_send_return );
114 |
115 | do_action('derweili_mbot_woocommerce_after_optin_message', $message, $order );
116 |
117 | }else{
118 | derweili_mbot_log( "Optin Message does not contain a valid prefix" );
119 | derweili_mbot_log( "Optin Message is " . $message['optin']['ref'] );
120 |
121 | };
122 |
123 | }else{
124 | derweili_mbot_log( "Webhook Call is not an optin message" );
125 | };
126 |
127 | }; //endforeach
128 | }else{
129 |
130 | derweili_mbot_log( "Webhook Call contains no message" );
131 |
132 | }; //endif
133 |
134 | }
135 |
136 | } // function
137 |
138 |
--------------------------------------------------------------------------------
/inc/settingspage.php:
--------------------------------------------------------------------------------
1 | domain_whitelisting_button();
19 |
20 | $this->init();
21 |
22 | }
23 |
24 | public static function init() {
25 | add_filter( 'woocommerce_settings_tabs_array', __CLASS__ . '::add_settings_tab', 50 );
26 | add_action( 'woocommerce_settings_tabs_mbot_settings', __CLASS__ . '::settings_tab' );
27 | add_action( 'woocommerce_update_options_mbot_settings', __CLASS__ . '::update_settings' );
28 |
29 |
30 | }
31 |
32 |
33 | /**
34 | * Add a new settings tab to the WooCommerce settings tabs array.
35 | *
36 | * @param array $settings_tabs Array of WooCommerce setting tabs & their labels, excluding the Subscription tab.
37 | * @return array $settings_tabs Array of WooCommerce setting tabs & their labels, including the Subscription tab.
38 | */
39 | public static function add_settings_tab( $settings_tabs ) {
40 | $settings_tabs['mbot_settings'] = __( 'Messenger Bot', 'mbot-woocommmerce' );
41 | return $settings_tabs;
42 | }
43 | /**
44 | * Uses the WooCommerce admin fields API to output settings via the @see woocommerce_admin_fields() function.
45 | *
46 | * @uses woocommerce_admin_fields()
47 | * @uses self::get_settings()
48 | */
49 | public static function settings_tab() {
50 | woocommerce_admin_fields( self::get_settings() );
51 | }
52 | /**
53 | * Uses the WooCommerce options API to save settings via the @see woocommerce_update_options() function.
54 | *
55 | * @uses woocommerce_update_options()
56 | * @uses self::get_settings()
57 | */
58 | public static function update_settings() {
59 | woocommerce_update_options( self::get_settings() );
60 |
61 |
62 | }
63 | /**
64 | * Get all the settings for this plugin for @see woocommerce_admin_fields() function.
65 | *
66 | * @return array Array of settings for @see woocommerce_admin_fields() function.
67 | */
68 | public static function get_settings() {
69 | $settings = array(
70 | 'facebook_api_credentials_title' => array(
71 | 'name' => __( 'Facebook API Credentials', 'mbot-woocommmerce' ),
72 | 'type' => 'title',
73 | 'desc' => __( 'Your Callback URL is:', 'mbot-woocommmerce' ) . ' ' . get_home_url() . '/mbot-callback-webhook/' ,
74 | 'id' => 'derweili_mbot_fb_credentials_title'
75 | ),
76 | 'Page_ID' => array(
77 | 'name' => __( 'Page ID', 'mbot-woocommmerce' ),
78 | 'type' => 'text',
79 | 'desc' => __( '', 'mbot-woocommmerce' ),
80 | 'id' => 'derweili_mbot_page_id'
81 | ),
82 | 'Messenger_APP_ID' => array(
83 | 'name' => __( 'Messenger App ID', 'mbot-woocommmerce' ),
84 | 'type' => 'text',
85 | 'desc' => __( '', 'mbot-woocommmerce' ),
86 | 'id' => 'derweili_mbot_messenger_app_id'
87 | ),
88 | 'page_token' => array(
89 | 'name' => __( 'Page Tooken', 'mbot-woocommmerce' ),
90 | 'type' => 'text',
91 | 'desc' => __( '', 'mbot-woocommmerce' ),
92 | 'id' => 'derweili_mbot_page_token'
93 | ),
94 | 'verify_tooken' => array(
95 | 'name' => __( 'Verify Token', 'mbot-woocommmerce' ),
96 | 'type' => 'text',
97 | 'desc' => __( '', 'mbot-woocommmerce' ),
98 | 'id' => 'derweili_mbot_verify_token'
99 | ),
100 | /* 'checkbox-prechecked' => array(
101 | 'name' => __( 'Precheck checkbox?', 'mbot-woocommmerce' ),
102 | 'type' => 'checkbox',
103 | //'desc' => __( 'Your Callback URL is:', 'mbot-woocommmerce' ) . ' ' . plugin_dir_url( __FILE__ ) . 'webhook.php' ,
104 | 'id' => 'derweili_mbot_fb_checkbox_prechecked'
105 | ),
106 | 'checkbox-allow-login' => array(
107 | 'name' => __( 'Allow Login', 'mbot-woocommmerce' ),
108 | 'type' => 'checkbox',
109 | //'desc' => __( 'Your Callback URL is:', 'mbot-woocommmerce' ) . ' ' . plugin_dir_url( __FILE__ ) . 'webhook.php' ,
110 | 'id' => 'derweili_mbot_fb_checkbox_allow_login'
111 | ),*/
112 | 'checkbox-size' => array(
113 | 'name' => __( 'Checkbox size', 'mbot-woocommmerce' ),
114 | 'type' => 'select',
115 | 'id' => 'derweili_mbot_checkbox_size',
116 | 'options' => array(
117 | 'standard' => 'Standard',
118 | 'small' => 'Small',
119 | 'medium' => 'Medium',
120 | 'large' => 'Large',
121 | 'xlarge' => 'xLarge',
122 | )
123 | ),
124 | 'send-to-messenger-color' => array(
125 | 'name' => __( 'Send to Messenger Button color', 'mbot-woocommmerce' ),
126 | 'type' => 'select',
127 | 'id' => 'derweili_mbot_button_color',
128 | 'options' => array(
129 | 'blue' => 'Blau',
130 | 'white' => 'Weiß',
131 | )
132 | ),
133 | 'section_end' => array(
134 | 'type' => 'sectionend',
135 | 'id' => 'wc_mbot_settings_section_end'
136 | )
137 | );
138 | return apply_filters( 'wc_mbot_settings_settings', $settings );
139 | }
140 |
141 |
142 |
143 | }
144 |
145 | $derweili_mbot_settings_page = new DERWEEILI_MBOT_WOOCOMMERCE_SETTINGS_PAGE();
146 |
147 |
148 |
149 |
150 | add_filter( 'woocommerce_get_sections_mbot_settings', 'derweili_add_messages_settings_section' );
151 | function derweili_add_messages_settings_section( $sections ) {
152 |
153 | $sections['mbot_messages'] = __( 'Nachrichten', 'text-domain' );
154 | $sections['testsection'] = __( 'testsection', 'text-domain' );
155 | return $sections;
156 |
157 | }
158 |
159 | }
160 | /*
161 | add_filter( 'woocommerce_get_settings_pages', 'so_26355697_add_settings_page' );
162 | function so_26355697_add_settings_page( $settings ) {
163 | $settings[] = include( 'wc-plugin-settings.php' );
164 | return $settings;
165 | }*/
--------------------------------------------------------------------------------
/inc/WooOrderMessage.php:
--------------------------------------------------------------------------------
1 | recipient = $recipient;
25 | $this->type = "receipt";
26 | $this->is_reference = $is_reference;
27 | if( $is_reference ) $this->recipient_type = 'user_ref';
28 |
29 |
30 | $this->recipient_name = $order->get_formatted_shipping_full_name();
31 | $this->order_number = $order->get_order_number();
32 | //$this->order_number = rand(10000, 99999);
33 | $this->currency = $order->order_currency;
34 | $this->payment_method = $order->payment_method_title;
35 | $this->order_url = 'http://derweili.de/';
36 | $this->timestamp = strtotime( $order->order_date );
37 | $this->elements = [];
38 |
39 |
40 | //Elements
41 | foreach ($order->get_items() as $item) {
42 |
43 | $image_url = "";
44 | $product_id = $item["product_id"];
45 | if ( has_post_thumbnail( $product_id ) ) {
46 | $image_url = get_the_post_thumbnail_url( $product_id, "full" );
47 | }
48 |
49 | $item_price = $item['line_subtotal'];
50 |
51 | // Check if Store shows tax in card
52 | if( 'incl' == get_option( 'woocommerce_tax_display_cart', $default ) ){
53 |
54 | $item_price = $item_price + $item['line_subtotal_tax']; // add tax to line items when store displays tax in cart
55 |
56 | };
57 |
58 | $this->elements[] = new pimax\Messages\MessageReceiptElement(
59 | $item['name'], //headline
60 | "", //subline
61 | $image_url, //image url
62 | $item['qty'], //quantity
63 | number_format( $item_price, 2 ), //price
64 | $order->order_currency //currency
65 | );
66 | }
67 |
68 | //Address
69 | $this->address = new pimax\Messages\Address([
70 | 'country' => apply_filters( 'derweili_mbot_wooorder_address_country', $order->shipping_country ),
71 | 'state' => apply_filters( 'derweili_mbot_wooorder_address_state', $order->shipping_state ),
72 | 'postal_code' => apply_filters( 'derweili_mbot_wooorder_address_postcode', $order->shipping_postcode ),
73 | 'city' => apply_filters( 'derweili_mbot_wooorder_address_city', $order->shipping_city ),
74 | 'street_1' => apply_filters( 'derweili_mbot_wooorder_address_street_1', $order->shipping_address_1 ),
75 | 'street_2' => apply_filters( 'derweili_mbot_wooorder_address_street_2', $order->shipping_address_2 ),
76 | ]);
77 |
78 | //Summary
79 | $this->summary = new pimax\Messages\Summary([
80 | 'subtotal' => number_format( $order->get_subtotal(), 2 ),
81 | 'shipping_cost' => number_format( $order->order_shipping, 2 ),
82 | 'total_tax' => number_format( $order->get_total_tax(), 2 ),
83 | 'total_cost' => number_format( $order->order_total, 2 ),
84 | ]);
85 |
86 | // fees
87 | if ( $order->get_fees() ) { //Only display cupouns and discount when available
88 |
89 | foreach ( $order->get_fees() as $order_fee) {
90 | $this->adjustments[] =
91 | new pimax\Messages\Adjustment([
92 | 'name' => $order_fee["name"],
93 | 'amount' => $order_fee["line_total"]
94 | ]);
95 | }
96 |
97 |
98 | }
99 |
100 | //Adjustments (Cupouns/Discount)
101 | if ($order->get_total_discount() != 0) { //Only display cupouns and discount when available
102 |
103 | $this->adjustments[] =
104 | new pimax\Messages\Adjustment([
105 | 'name' => 'Gutscheine und Rabatte',
106 | 'amount' => $order->get_total_discount()
107 | ]);
108 |
109 | }
110 |
111 | }
112 |
113 |
114 |
115 | public function getData()
116 | {
117 | $result = [
118 | 'attachment' => [
119 | 'type' => 'template',
120 | 'payload' => [
121 | 'template_type' => $this->type
122 | ]
123 | ]
124 | ];
125 |
126 | switch ($this->type)
127 | {
128 | case self::TYPE_BUTTON:
129 | $result['attachment']['payload']['text'] = $this->title;
130 | $result['attachment']['payload']['buttons'] = [];
131 |
132 | foreach ($this->buttons as $btn) {
133 | $result['attachment']['payload']['buttons'][] = $btn->getData();
134 | }
135 |
136 | break;
137 |
138 | case self::TYPE_GENERIC:
139 | $result['attachment']['payload']['elements'] = [];
140 |
141 | foreach ($this->elements as $btn) {
142 | $result['attachment']['payload']['elements'][] = $btn->getData();
143 | }
144 | break;
145 |
146 | case self::TYPE_RECEIPT:
147 | $result['attachment']['payload']['recipient_name'] = $this->recipient_name;
148 | $result['attachment']['payload']['order_number'] = $this->order_number;
149 | $result['attachment']['payload']['currency'] = $this->currency;
150 | $result['attachment']['payload']['payment_method'] = $this->payment_method;
151 | $result['attachment']['payload']['order_url'] = $this->order_url;
152 | $result['attachment']['payload']['timestamp'] = $this->timestamp;
153 | $result['attachment']['payload']['elements'] = [];
154 |
155 | foreach ($this->elements as $btn) {
156 | $result['attachment']['payload']['elements'][] = $btn->getData();
157 | }
158 |
159 | $result['attachment']['payload']['address'] = $this->address->getData();
160 | $result['attachment']['payload']['summary'] = $this->summary->getData();
161 | $result['attachment']['payload']['adjustments'] = [];
162 |
163 | foreach ($this->adjustments as $btn) {
164 | $result['attachment']['payload']['adjustments'][] = $btn->getData();
165 | }
166 | break;
167 | }
168 |
169 | $this->get_data_return['message'] = $result;
170 |
171 | /*if ( $this->is_reference ) {
172 | $this->get_data_return['recipient'] = [
173 | 'user_ref' => $this->recipient
174 | ];
175 | }else{
176 | $this->get_data_return['recipient'] = [
177 | 'id' => $this->recipient
178 | ];
179 | }*/
180 | $this->get_data_return['recipient'] = [
181 | $this->recipient_type => $this->recipient
182 | ];
183 |
184 | return $this->get_data_return;
185 |
186 | }
187 |
188 |
189 |
190 | }
191 |
--------------------------------------------------------------------------------
/languages/mbot-woocommerce.pot:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 Messengerbot for WooCommerce
2 | # This file is distributed under the same license as the Messengerbot for WooCommerce package.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: Messengerbot for WooCommerce 1.18\n"
6 | "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/messenger-bot-for-"
7 | "woocommerce\n"
8 | "POT-Creation-Date: 2017-01-31 19:30:49+00:00\n"
9 | "MIME-Version: 1.0\n"
10 | "Content-Type: text/plain; charset=UTF-8\n"
11 | "Content-Transfer-Encoding: 8bit\n"
12 | "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
13 | "Last-Translator: FULL NAME \n"
14 | "Language-Team: LANGUAGE \n"
15 |
16 | #: inc/checkout-fields.php:64
17 | msgid "Contact Options"
18 | msgstr ""
19 |
20 | #: inc/checkout-fields.php:64
21 | msgid "Receive updates in Messenger"
22 | msgstr ""
23 |
24 | #: inc/checkout-fields.php:70 inc/checkout-fields.php:76
25 | msgid "Enter something"
26 | msgstr ""
27 |
28 | #: inc/order-status-action-manager.php:52 inc/settingspage.php:40
29 | #: inc/wc-plugin-settings.php:25
30 | msgid "Messenger Bot"
31 | msgstr ""
32 |
33 | #: inc/settingspage.php:71 inc/wc-plugin-settings.php:209
34 | msgid "Facebook API Credentials"
35 | msgstr ""
36 |
37 | #: inc/settingspage.php:73 inc/wc-plugin-settings.php:211
38 | msgid "Your Callback URL is:"
39 | msgstr ""
40 |
41 | #: inc/settingspage.php:77 inc/wc-plugin-settings.php:215
42 | msgid "Page ID"
43 | msgstr ""
44 |
45 | #: inc/settingspage.php:83 inc/wc-plugin-settings.php:221
46 | msgid "Messenger App ID"
47 | msgstr ""
48 |
49 | #: inc/settingspage.php:89 inc/wc-plugin-settings.php:227
50 | msgid "Page Tooken"
51 | msgstr ""
52 |
53 | #: inc/settingspage.php:95 inc/wc-plugin-settings.php:233
54 | msgid "Verify Token"
55 | msgstr ""
56 |
57 | #: inc/settingspage.php:113 inc/wc-plugin-settings.php:131
58 | msgid "Checkbox size"
59 | msgstr ""
60 |
61 | #: inc/settingspage.php:125 inc/wc-plugin-settings.php:178
62 | msgid "Send to Messenger Button color"
63 | msgstr ""
64 |
65 | #: inc/settingspage.php:153
66 | msgid "Nachrichten"
67 | msgstr ""
68 |
69 | #: inc/settingspage.php:154
70 | msgid "testsection"
71 | msgstr ""
72 |
73 | #: inc/update.php:57
74 | msgid ""
75 | "Thank you for your order, you will be immediately notified when your order "
76 | "status changes."
77 | msgstr ""
78 |
79 | #: inc/update.php:58
80 | msgid "Your order is now pendig."
81 | msgstr ""
82 |
83 | #: inc/update.php:59
84 | msgid "Your order unfortunately failed."
85 | msgstr ""
86 |
87 | #: inc/update.php:60
88 | msgid "Your order is now on hold."
89 | msgstr ""
90 |
91 | #: inc/update.php:61
92 | msgid "Your order is now processing"
93 | msgstr ""
94 |
95 | #: inc/update.php:62
96 | msgid "Your order has been completed"
97 | msgstr ""
98 |
99 | #: inc/update.php:63
100 | msgid "Your order has been refunded"
101 | msgstr ""
102 |
103 | #: inc/update.php:64
104 | msgid "Your order has been cancelled"
105 | msgstr ""
106 |
107 | #: inc/wc-plugin-settings.php:37
108 | msgid "API Credentials"
109 | msgstr ""
110 |
111 | #: inc/wc-plugin-settings.php:38
112 | msgid "Appearance"
113 | msgstr ""
114 |
115 | #: inc/wc-plugin-settings.php:39 inc/wc-plugin-settings.php:60
116 | msgid "Messages"
117 | msgstr ""
118 |
119 | #: inc/wc-plugin-settings.php:66
120 | msgid "New Order"
121 | msgstr ""
122 |
123 | #: inc/wc-plugin-settings.php:68
124 | msgid "This is the message the user will recieve when they placed the order."
125 | msgstr ""
126 |
127 | #: inc/wc-plugin-settings.php:72
128 | msgid "Pending Order"
129 | msgstr ""
130 |
131 | #: inc/wc-plugin-settings.php:74
132 | msgid ""
133 | "This is the message the user will recieve when the order status changed to "
134 | "\"pending\"."
135 | msgstr ""
136 |
137 | #: inc/wc-plugin-settings.php:78
138 | msgid "Failed Order"
139 | msgstr ""
140 |
141 | #: inc/wc-plugin-settings.php:80
142 | msgid "This is the message the user will recieve when the order failed."
143 | msgstr ""
144 |
145 | #: inc/wc-plugin-settings.php:84
146 | msgid "On Hold"
147 | msgstr ""
148 |
149 | #: inc/wc-plugin-settings.php:86
150 | msgid ""
151 | "This is the message the user will recieve when the order gets the status "
152 | "\"on hold\"."
153 | msgstr ""
154 |
155 | #: inc/wc-plugin-settings.php:90
156 | msgid "Processing"
157 | msgstr ""
158 |
159 | #: inc/wc-plugin-settings.php:92
160 | msgid ""
161 | "This is the message the user will recieve when the order gets the status "
162 | "\"processing\"."
163 | msgstr ""
164 |
165 | #: inc/wc-plugin-settings.php:96
166 | msgid "Completed Order"
167 | msgstr ""
168 |
169 | #: inc/wc-plugin-settings.php:98
170 | msgid ""
171 | "This is the message the user will recieve when the order gets the status "
172 | "\"completed\"."
173 | msgstr ""
174 |
175 | #: inc/wc-plugin-settings.php:102
176 | msgid "Refunded Order"
177 | msgstr ""
178 |
179 | #: inc/wc-plugin-settings.php:104
180 | msgid ""
181 | "This is the message the user will recieve when the order gets the status "
182 | "\"refunded\"."
183 | msgstr ""
184 |
185 | #: inc/wc-plugin-settings.php:108
186 | msgid "Cancelled Order"
187 | msgstr ""
188 |
189 | #: inc/wc-plugin-settings.php:110
190 | msgid ""
191 | "This is the message the user will recieve when the order gets the status "
192 | "\"cancelled\"."
193 | msgstr ""
194 |
195 | #: inc/wc-plugin-settings.php:125
196 | msgid "Appearance of the Facebook Messenger Plugins"
197 | msgstr ""
198 |
199 | #: inc/wc-plugin-settings.php:135
200 | msgid "Small"
201 | msgstr ""
202 |
203 | #: inc/wc-plugin-settings.php:136
204 | msgid "Medium"
205 | msgstr ""
206 |
207 | #: inc/wc-plugin-settings.php:137 inc/wc-plugin-settings.php:172
208 | msgid "Large"
209 | msgstr ""
210 |
211 | #: inc/wc-plugin-settings.php:138 inc/wc-plugin-settings.php:173
212 | msgid "Standard"
213 | msgstr ""
214 |
215 | #: inc/wc-plugin-settings.php:139 inc/wc-plugin-settings.php:174
216 | msgid "xLarge"
217 | msgstr ""
218 |
219 | #: inc/wc-plugin-settings.php:150
220 | msgid "Initial checkbox status"
221 | msgstr ""
222 |
223 | #: inc/wc-plugin-settings.php:154
224 | msgid "Checked"
225 | msgstr ""
226 |
227 | #: inc/wc-plugin-settings.php:155
228 | msgid "Unchecked"
229 | msgstr ""
230 |
231 | #: inc/wc-plugin-settings.php:159
232 | msgid "Allow / disallow login"
233 | msgstr ""
234 |
235 | #: inc/wc-plugin-settings.php:163
236 | msgid "Allow Login"
237 | msgstr ""
238 |
239 | #: inc/wc-plugin-settings.php:164
240 | msgid "Disallow Login"
241 | msgstr ""
242 |
243 | #: inc/wc-plugin-settings.php:168
244 | msgid "Send-to-Messenger Button size"
245 | msgstr ""
246 |
247 | #: inc/wc-plugin-settings.php:182
248 | msgid "Blue"
249 | msgstr ""
250 |
251 | #: inc/wc-plugin-settings.php:183
252 | msgid "White"
253 | msgstr ""
254 |
255 | #: inc/wc-plugin-settings.php:187
256 | msgid "Send-to-Messenger User Login"
257 | msgstr ""
258 |
259 | #: inc/wc-plugin-settings.php:191
260 | msgid "Enforce Login for every user"
261 | msgstr ""
262 |
263 | #: inc/wc-plugin-settings.php:192
264 | msgid "Enable Login only for logged out users"
265 | msgstr ""
266 |
267 | #: inc/wc-plugin-settings.php:211
268 | msgid ""
269 | "Following URLs are currently whitelisted for the use of the messenger "
270 | "checkbox plugin:
"
271 | msgstr ""
272 |
273 | #: inc/woocommerce-order-status-messages.php:87
274 | msgid "View Tracking"
275 | msgstr ""
276 |
277 | #: inc/woocommerce-thank-you.php:112
278 | msgid "Get notified about Updates via Facebook Messenger"
279 | msgstr ""
280 |
281 | #. Plugin Name of the plugin/theme
282 | msgid "Messengerbot for WooCommerce"
283 | msgstr ""
284 |
285 | #. Plugin URI of the plugin/theme
286 | msgid "http://www.derweili.de"
287 | msgstr ""
288 |
289 | #. Description of the plugin/theme
290 | msgid ""
291 | "Stay in contact with you customers via Facebook Messenger. Send them "
292 | "notifications when the order status changes."
293 | msgstr ""
294 |
295 | #. Author of the plugin/theme
296 | msgid "derweili"
297 | msgstr ""
298 |
299 | #. Author URI of the plugin/theme
300 | msgid "http://www.derweili.de/"
301 | msgstr ""
302 |
--------------------------------------------------------------------------------
/languages/mbot-woocommerce-de_DE.po:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2016 Messengerbot for WooCommerce
2 | # This file is distributed under the same license as the Messengerbot for WooCommerce package.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: Messengerbot for WooCommerce 1.1\n"
6 | "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/messenger-bot-for-"
7 | "woocommerce\n"
8 | "POT-Creation-Date: 2017-01-31 19:30:49+00:00\n"
9 | "PO-Revision-Date: 2017-01-31 20:31+0100\n"
10 | "Last-Translator: Julian Weiland \n"
11 | "Language-Team: \n"
12 | "Language: Deutsch\n"
13 | "MIME-Version: 1.0\n"
14 | "Content-Type: text/plain; charset=UTF-8\n"
15 | "Content-Transfer-Encoding: 8bit\n"
16 | "X-Generator: Poedit 1.5.5\n"
17 |
18 | #: inc/checkout-fields.php:64
19 | msgid "Contact Options"
20 | msgstr "Kontaktmöglichkeiten"
21 |
22 | #: inc/checkout-fields.php:64
23 | msgid "Receive updates in Messenger"
24 | msgstr "Erhalte Nachrichten zu deiner Bestellung über den Facebook Messenger"
25 |
26 | #: inc/checkout-fields.php:70 inc/checkout-fields.php:76
27 | msgid "Enter something"
28 | msgstr "Ausfüllen"
29 |
30 | #: inc/order-status-action-manager.php:52 inc/settingspage.php:40
31 | #: inc/wc-plugin-settings.php:25
32 | msgid "Messenger Bot"
33 | msgstr "Messenger Bot"
34 |
35 | #: inc/settingspage.php:71 inc/wc-plugin-settings.php:209
36 | msgid "Facebook API Credentials"
37 | msgstr "Facebook API Zugangsdaten"
38 |
39 | #: inc/settingspage.php:73 inc/wc-plugin-settings.php:211
40 | msgid "Your Callback URL is:"
41 | msgstr "Deine Webhook URL lautet:"
42 |
43 | #: inc/settingspage.php:77 inc/wc-plugin-settings.php:215
44 | msgid "Page ID"
45 | msgstr "Seiten ID"
46 |
47 | #: inc/settingspage.php:83 inc/wc-plugin-settings.php:221
48 | msgid "Messenger App ID"
49 | msgstr "Messenger APP ID"
50 |
51 | #: inc/settingspage.php:89 inc/wc-plugin-settings.php:227
52 | msgid "Page Tooken"
53 | msgstr "Seiten Token"
54 |
55 | #: inc/settingspage.php:95 inc/wc-plugin-settings.php:233
56 | msgid "Verify Token"
57 | msgstr "Verifizierungs Token"
58 |
59 | #: inc/settingspage.php:113 inc/wc-plugin-settings.php:131
60 | msgid "Checkbox size"
61 | msgstr "Checkbox Größe"
62 |
63 | #: inc/settingspage.php:125 inc/wc-plugin-settings.php:178
64 | msgid "Send to Messenger Button color"
65 | msgstr "Farbe des \"An Messenger Senden\" Buttons"
66 |
67 | #: inc/settingspage.php:153
68 | msgid "Nachrichten"
69 | msgstr "Nachrichten"
70 |
71 | #: inc/settingspage.php:154
72 | msgid "testsection"
73 | msgstr ""
74 |
75 | #: inc/update.php:57
76 | msgid ""
77 | "Thank you for your order, you will be immediately notified when your order "
78 | "status changes."
79 | msgstr ""
80 | "Vielen Dank für deine Bestellung, du wirst über Änderungen und den aktuellen "
81 | "Status deiner Bestellung ab sofort automatisch informiert."
82 |
83 | #: inc/update.php:58
84 | msgid "Your order is now pendig."
85 | msgstr "Der Status deiner Bestellung wurde in \"In Bearbeitung\" geändert."
86 |
87 | #: inc/update.php:59
88 | msgid "Your order unfortunately failed."
89 | msgstr "Ihre Bestellung ist leider fehlgeschlagen."
90 |
91 | #: inc/update.php:60
92 | msgid "Your order is now on hold."
93 | msgstr "Der Status deiner Bestellung wurde geändert zu \"Wartend\"."
94 |
95 | #: inc/update.php:61
96 | msgid "Your order is now processing"
97 | msgstr "Deine Bestellung ist nun in Bearbeitung"
98 |
99 | #: inc/update.php:62
100 | msgid "Your order has been completed"
101 | msgstr "Deine Bestellung wurde fertiggestellt"
102 |
103 | #: inc/update.php:63
104 | msgid "Your order has been refunded"
105 | msgstr "Deine Bestellung wurde zurückerstattet"
106 |
107 | #: inc/update.php:64
108 | msgid "Your order has been cancelled"
109 | msgstr "Deine Bestellung wurde storniert"
110 |
111 | #: inc/wc-plugin-settings.php:37
112 | #, fuzzy
113 | msgid "API Credentials"
114 | msgstr "Facebook API Zugangsdaten"
115 |
116 | #: inc/wc-plugin-settings.php:38
117 | msgid "Appearance"
118 | msgstr "Darstellung"
119 |
120 | #: inc/wc-plugin-settings.php:39 inc/wc-plugin-settings.php:60
121 | msgid "Messages"
122 | msgstr "Nachrichten"
123 |
124 | #: inc/wc-plugin-settings.php:66
125 | msgid "New Order"
126 | msgstr "Neue Bestellung"
127 |
128 | #: inc/wc-plugin-settings.php:68
129 | msgid "This is the message the user will recieve when they placed the order."
130 | msgstr ""
131 | "Diese Nachricht wird versendet, sobald der Nutzer die Bestellung "
132 | "abgeschlossen hat."
133 |
134 | #: inc/wc-plugin-settings.php:72
135 | msgid "Pending Order"
136 | msgstr "Ausstehende Bestellung"
137 |
138 | #: inc/wc-plugin-settings.php:74
139 | msgid ""
140 | "This is the message the user will recieve when the order status changed to "
141 | "\"pending\"."
142 | msgstr ""
143 | "Diese Nachricht wird an den Kunden gesendet, sobald die Bestellung den "
144 | "Status \"Zahlung ausstehend\" erhält."
145 |
146 | #: inc/wc-plugin-settings.php:78
147 | msgid "Failed Order"
148 | msgstr "Fehlgeschlagende Bestellung"
149 |
150 | #: inc/wc-plugin-settings.php:80
151 | msgid "This is the message the user will recieve when the order failed."
152 | msgstr ""
153 | "Diese Nachricht wird an den Nutzer gesendet, sobald die Bestellung den "
154 | "Status \"Fehlgeschlagen\" erhält"
155 |
156 | #: inc/wc-plugin-settings.php:84
157 | msgid "On Hold"
158 | msgstr "Wartestellung"
159 |
160 | #: inc/wc-plugin-settings.php:86
161 | msgid ""
162 | "This is the message the user will recieve when the order gets the status "
163 | "\"on hold\"."
164 | msgstr ""
165 | "Diese Nachricht wird an den Nutze gesendet, sobald die Bestellung den Status "
166 | "\"Wartestellung\" erhält."
167 |
168 | #: inc/wc-plugin-settings.php:90
169 | msgid "Processing"
170 | msgstr "In Bearbeitung"
171 |
172 | #: inc/wc-plugin-settings.php:92
173 | msgid ""
174 | "This is the message the user will recieve when the order gets the status "
175 | "\"processing\"."
176 | msgstr ""
177 | "Diese Nachricht wird versendet, sobald die Bestellung den Status \"In "
178 | "Bearbeitung\" erhält"
179 |
180 | #: inc/wc-plugin-settings.php:96
181 | msgid "Completed Order"
182 | msgstr "Bestellung Fertiggestellt"
183 |
184 | #: inc/wc-plugin-settings.php:98
185 | msgid ""
186 | "This is the message the user will recieve when the order gets the status "
187 | "\"completed\"."
188 | msgstr ""
189 | "Diese Nachricht wird versendet, sobald die Bestellung fertiggestellt wurde"
190 |
191 | #: inc/wc-plugin-settings.php:102
192 | msgid "Refunded Order"
193 | msgstr "Rückerstattet"
194 |
195 | #: inc/wc-plugin-settings.php:104
196 | msgid ""
197 | "This is the message the user will recieve when the order gets the status "
198 | "\"refunded\"."
199 | msgstr ""
200 | "Diese Nachricht wird versendet, sobald die Bestellung den Status "
201 | "\"Rückerstattung\" erhält."
202 |
203 | #: inc/wc-plugin-settings.php:108
204 | msgid "Cancelled Order"
205 | msgstr "Stornierte Bestellung"
206 |
207 | #: inc/wc-plugin-settings.php:110
208 | msgid ""
209 | "This is the message the user will recieve when the order gets the status "
210 | "\"cancelled\"."
211 | msgstr ""
212 | "Diese Nachricht wird versendet, sobald die Bestellung den Status "
213 | "\"Stornierte Bestellung\" erhält."
214 |
215 | #: inc/wc-plugin-settings.php:125
216 | msgid "Appearance of the Facebook Messenger Plugins"
217 | msgstr "Darstellung der Facebook Messenger Plugins"
218 |
219 | #: inc/wc-plugin-settings.php:135
220 | msgid "Small"
221 | msgstr "Klein"
222 |
223 | #: inc/wc-plugin-settings.php:136
224 | msgid "Medium"
225 | msgstr "Mittel"
226 |
227 | #: inc/wc-plugin-settings.php:137 inc/wc-plugin-settings.php:172
228 | msgid "Large"
229 | msgstr "Groß"
230 |
231 | #: inc/wc-plugin-settings.php:138 inc/wc-plugin-settings.php:173
232 | msgid "Standard"
233 | msgstr "Standard"
234 |
235 | #: inc/wc-plugin-settings.php:139 inc/wc-plugin-settings.php:174
236 | msgid "xLarge"
237 | msgstr "Extra Groß"
238 |
239 | #: inc/wc-plugin-settings.php:150
240 | msgid "Initial checkbox status"
241 | msgstr "Initialer Checkbox Status"
242 |
243 | #: inc/wc-plugin-settings.php:154
244 | #, fuzzy
245 | msgid "Checked"
246 | msgstr "Checkbox Größe"
247 |
248 | #: inc/wc-plugin-settings.php:155
249 | msgid "Unchecked"
250 | msgstr "nicht ausgewählt"
251 |
252 | #: inc/wc-plugin-settings.php:159
253 | msgid "Allow / disallow login"
254 | msgstr "Login erlauben / verbieten"
255 |
256 | #: inc/wc-plugin-settings.php:163
257 | msgid "Allow Login"
258 | msgstr "Login ermöglichen"
259 |
260 | #: inc/wc-plugin-settings.php:164
261 | msgid "Disallow Login"
262 | msgstr "Login nicht ermöglichen"
263 |
264 | #: inc/wc-plugin-settings.php:168
265 | #, fuzzy
266 | msgid "Send-to-Messenger Button size"
267 | msgstr "Farbe des \"An Messenger Senden\" Buttons"
268 |
269 | #: inc/wc-plugin-settings.php:182
270 | msgid "Blue"
271 | msgstr "Blau"
272 |
273 | #: inc/wc-plugin-settings.php:183
274 | msgid "White"
275 | msgstr "Weiß"
276 |
277 | #: inc/wc-plugin-settings.php:187
278 | #, fuzzy
279 | msgid "Send-to-Messenger User Login"
280 | msgstr "Farbe des \"An Messenger Senden\" Buttons"
281 |
282 | #: inc/wc-plugin-settings.php:191
283 | msgid "Enforce Login for every user"
284 | msgstr "Login für alle Nutzer erzwingen"
285 |
286 | #: inc/wc-plugin-settings.php:192
287 | msgid "Enable Login only for logged out users"
288 | msgstr "Login nur für nicht angemeldete Facebook Nutzer erzwingen"
289 |
290 | #: inc/wc-plugin-settings.php:211
291 | msgid ""
292 | "Following URLs are currently whitelisted for the use of the messenger "
293 | "checkbox plugin:
"
294 | msgstr ""
295 | "Folgende URLs wurden aktuell für die Nutzung des Checkbox Plugins "
296 | "freigeschaltet:"
297 |
298 | #: inc/woocommerce-order-status-messages.php:87
299 | msgid "View Tracking"
300 | msgstr "Sendungsverfolgung ansehen"
301 |
302 | #: inc/woocommerce-thank-you.php:112
303 | msgid "Get notified about Updates via Facebook Messenger"
304 | msgstr ""
305 | "Bleibe mit Hilfe des Facebook Messengers über den aktuellen Status deiner "
306 | "Bestellung informiert."
307 |
308 | #. Plugin Name of the plugin/theme
309 | msgid "Messengerbot for WooCommerce"
310 | msgstr "Messenger Bot für WooCommerce"
311 |
312 | #. Plugin URI of the plugin/theme
313 | msgid "http://www.derweili.de"
314 | msgstr ""
315 |
316 | #. Description of the plugin/theme
317 | msgid ""
318 | "Stay in contact with you customers via Facebook Messenger. Send them "
319 | "notifications when the order status changes."
320 | msgstr ""
321 | "Bleibe mit deinen Kunden über den Facebook Messenger in Kontakt. Sende Ihnen "
322 | "Benachrichtigungen, sobald sich der Bestellstatus ändert."
323 |
324 | #. Author of the plugin/theme
325 | msgid "derweili"
326 | msgstr "derweili"
327 |
328 | #. Author URI of the plugin/theme
329 | msgid "http://www.derweili.de/"
330 | msgstr ""
331 |
332 | #~ msgid "Weiß"
333 | #~ msgstr "Weiß"
334 |
--------------------------------------------------------------------------------
/js/tourist.min.js:
--------------------------------------------------------------------------------
1 | /*! Tourist.js - http://easelinc.github.io/tourist, built 03-13-2015 */
2 |
3 | (function($) {
4 | (function(){var a,b,c,d,e={}.hasOwnProperty,f=function(a,b){function c(){this.constructor=a}for(var d in b)e.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g=function(a,b){return function(){return a.apply(b,arguments)}};window.Tourist=window.Tourist||{},Tourist.Model=function(b){function c(){return a=c.__super__.constructor.apply(this,arguments)}return f(c,b),c.prototype._module="Tourist",c}(Backbone.Model),window.Tourist.Tip=window.Tourist.Tip||{},Tourist.Tip.Base=function(){function a(a){this.options=null!=a?a:{},this.onClickNext=g(this.onClickNext,this),this.onClickClose=g(this.onClickClose,this),this.el=$(""),this.initialize(a),this._bindClickEvents(),Tourist.Tip.Base._cacheTip(this)}return a.prototype._module="Tourist",_.extend(a.prototype,Backbone.Events),a.prototype.skipButtonTemplate='',a.prototype.nextButtonTemplate='',a.prototype.finalButtonTemplate='',a.prototype.closeButtonTemplate='',a.prototype.okButtonTemplate='',a.prototype.actionLabelTemplate=_.template('<%= label %>
'),a.prototype.actionLabels=["Do this:","Then this:","Next this:"],a.prototype.highlightClass="tour-highlight",a.prototype.template=_.template('\n
\n <%= close_button %>\n <%= content %>\n
<%= counter%>
\n
\n
\n <%= buttons %>\n
\n
'),a.prototype.destroy=function(){return this.el.remove()},a.prototype.render=function(a){return this.hide(),a&&(this._setTarget(a.target||!1,a),this._setZIndex(""),this._renderContent(a,this._buildContentElement(a)),a.target&&this.show(),a.zIndex&&this._setZIndex(a.zIndex,a)),this},a.prototype.show=function(){},a.prototype.hide=function(){},a.prototype.setTarget=function(a,b){return this._setTarget(a,b)},a.prototype.cleanupCurrentTarget=function(){return this.target&&this.target.removeClass&&this.target.removeClass(this.highlightClass),this.target=null},a.prototype.onClickClose=function(a){return this.trigger("click:close",this,a),!1},a.prototype.onClickNext=function(a){return this.trigger("click:next",this,a),!1},a.prototype._getTipElement=function(){},a.prototype._renderContent=function(){},a.prototype._bindClickEvents=function(){var a;return a=this._getTipElement(),a.delegate(".tour-close","click",this.onClickClose),a.delegate(".tour-next","click",this.onClickNext)},a.prototype._setTarget=function(a,b){return this.cleanupCurrentTarget(),a&&b&&b.highlightTarget&&a.addClass(this.highlightClass),this.target=a},a.prototype._setZIndex=function(a){var b;return b=this._getTipElement(),b.css("z-index",a||"")},a.prototype._buildContentElement=function(a){var b,c;return b=this._buildButtons(a),c=$($.parseHTML(this.template({content:a.content,buttons:b,close_button:this._buildCloseButton(a),counter:a.final?"":"step "+(a.index+1)+" of "+a.total,counter_class:a.final?"final":""}))),b||c.find(".tour-buttons").addClass("no-buttons"),this._renderActionLabels(c),c},a.prototype._buildButtons=function(a){var b;return b="",a.okButton&&(b+=this.okButtonTemplate),a.skipButton&&(b+=this.skipButtonTemplate),a.nextButton&&(b+=a.final?this.finalButtonTemplate:this.nextButtonTemplate),b},a.prototype._buildCloseButton=function(a){return a.closeButton?this.closeButtonTemplate:""},a.prototype._renderActionLabels=function(a){var b,c,d,e,f,g,h;for(d=a.find(".action"),c=0,h=[],f=0,g=d.length;g>f;f++)b=d[f],e=$($.parseHTML(this.actionLabelTemplate({label:this.actionLabels[c]}))),e.insertBefore(b),h.push(c++);return h},a._cacheTip=function(a){return Tourist.Tip.Base._cachedTips||(Tourist.Tip.Base._cachedTips=[]),Tourist.Tip.Base._cachedTips.push(a)},a.destroy=function(){var a,b,c,d;if(Tourist.Tip.Base._cachedTips){for(d=Tourist.Tip.Base._cachedTips,b=0,c=d.length;c>b;b++)a=d[b],a.destroy();return Tourist.Tip.Base._cachedTips=null}},a}(),Tourist.Tip.Bootstrap=function(a){function c(){return b=c.__super__.constructor.apply(this,arguments)}return f(c,a),c.prototype.initialize=function(a){var b;return b={showEffect:null,hideEffect:null},this.options=_.extend(b,a),this.tip=new Tourist.Tip.BootstrapTip(this.options)},c.prototype.destroy=function(){return this.tip.destroy(),c.__super__.destroy.call(this)},c.prototype.show=function(){var a;return this.options.showEffect?(a=Tourist.Tip.Bootstrap.effects[this.options.showEffect],a.call(this,this.tip,this.tip.el)):this.tip.show()},c.prototype.hide=function(){var a;return this.options.hideEffect?(a=Tourist.Tip.Bootstrap.effects[this.options.hideEffect],a.call(this,this.tip,this.tip.el)):this.tip.hide()},c.prototype._getTipElement=function(){return this.tip.el},c.prototype._setTarget=function(a,b){return c.__super__._setTarget.call(this,a,b),this.tip.setTarget(a)},c.prototype._renderContent=function(a,b){var c,d;return d=a.my||"left center",c=a.at||"right center",this.tip.setContainer(a.container||$("body")),this.tip.setContent(b),this.tip.setPosition(a.target||!1,d,c)},c}(Tourist.Tip.Base),Tourist.Tip.Bootstrap.effects={slidein:function(a,b){var c,d,e,f,g,h,i,j,k;for(c={top:80,left:80,right:-80,bottom:-80},h=a.my.split(" ")[0],h=h||"top",g=c[h],"bottom"===h&&(h="top"),"right"===h&&(h="left"),i=parseInt(b.css(h)),b.stop(),d={},d[h]=i+g,b.css(d),b.show(),d[h]=i,f=["easeOutCubic","swing","linear"],j=0,k=f.length;k>j&&(e=f[j],!$.easing[e]);j++);return b.animate(d,300,e),null}},Tourist.Tip.BootstrapTip=function(){function a(a){var b;b={offset:10,tipOffset:10},this.options=_.extend(b,a),this.el=$($.parseHTML(this.template)),this.hide()}return a.prototype.template='',a.prototype.FLIP_POSITION={bottom:"top",top:"bottom",left:"right",right:"left"},a.prototype.destroy=function(){return this.el.remove()},a.prototype.show=function(){return this.el.show().addClass("visible")},a.prototype.hide=function(){return this.el.hide().removeClass("visible")},a.prototype.setTarget=function(a){return this.target=a,this._setPosition(this.target,this.my,this.at)},a.prototype.setPosition=function(a,b,c){return this.target=a,this.my=b,this.at=c,this._setPosition(this.target,this.my,this.at)},a.prototype.setContainer=function(a){return a.append(this.el)},a.prototype.setContent=function(a){return this._getContentElement().html(a)},a.prototype._getContentElement=function(){return this.el.find(".popover-content")},a.prototype._getTipElement=function(){return this.el.find(".arrow")},a.prototype._setPosition=function(a,b,c){var d,e,f,g,h,i,j,k,l,m;return null==b&&(b="left center"),null==c&&(c="right center"),a&&(m=b.split(" "),d=m[0],h=m[1],f=this.el.css("display"),this.el.css({top:0,left:0,margin:0,display:"block"}).removeClass("top").removeClass("bottom").removeClass("left").removeClass("right").addClass(this.FLIP_POSITION[d]),a)?(j=this._getTipElement().css({left:"",right:"",top:"",bottom:""}),"center"!==h&&(k={left:j[0].offsetWidth/2,right:0,top:j[0].offsetHeight/2,bottom:0},e={},e[h]=k[h]+this.options.tipOffset,e[this.FLIP_POSITION[h]]="auto",j.css(e)),i=this._caculateTargetPosition(c,a),l=this._caculateTipPosition(b,i),g=this._adjustForArrow(b,l),this.el.css(g),this.el.css({display:f})):void 0},a.prototype._caculateTargetPosition=function(a,b){var c,d;return"[object Array]"===Object.prototype.toString.call(b)?{left:b[0],top:b[1]}:(c=this._getTargetBounds(b),d=this._lookupPosition(a,c.width,c.height),{left:c.left+d[0],top:c.top+d[1]})},a.prototype._caculateTipPosition=function(a,b){var c,d,e;return e=this.el[0].offsetWidth,c=this.el[0].offsetHeight,d=this._lookupPosition(a,e,c),{left:b.left-d[0],top:b.top-d[1]}},a.prototype._adjustForArrow=function(a,b){var c,d,e,f,g,h,i;switch(i=a.split(" "),c=i[0],f=i[1],g=this._getTipElement(),h=g[0].offsetWidth,d=g[0].offsetHeight,e={top:b.top,left:b.left},c){case"top":e.top+=d+this.options.offset;break;case"bottom":e.top-=d+this.options.offset;break;case"left":e.left+=h+this.options.offset;break;case"right":e.left-=h+this.options.offset}switch(f){case"left":e.left-=h/2+this.options.tipOffset;break;case"right":e.left+=h/2+this.options.tipOffset;break;case"top":e.top-=d/2+this.options.tipOffset;break;case"bottom":e.top+=d/2+this.options.tipOffset}return e},a.prototype._lookupPosition=function(a,b,c){var d,e,f;return f=b/2,d=c/2,e={"top left":[0,0],"left top":[0,0],"top right":[b,0],"right top":[b,0],"bottom left":[0,c],"left bottom":[0,c],"bottom right":[b,c],"right bottom":[b,c],"top center":[f,0],"left center":[0,d],"right center":[b,d],"bottom center":[f,c]},e[a]},a.prototype._getTargetBounds=function(a){var b,c;return b=a[0],c="function"==typeof b.getBoundingClientRect?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},$.extend({},c,a.offset())},a}(),Tourist.Tip.QTip=function(a){function b(){return this._renderTipBackground=g(this._renderTipBackground,this),c=b.__super__.constructor.apply(this,arguments)}var d,e,h,i;return f(b,a),i=6,h=14,d=10,e={top:80,left:80,right:-80,bottom:-80},b.prototype.QTIP_DEFAULTS={content:{text:" "},show:{ready:!1,delay:0,effect:function(a){var b,c,d,f,g;return c=$(this),f=a.options.position.my,f&&(f=f[f.precedance]),f=f||"top",d=e[f],"bottom"===f&&(f="top"),"right"===f&&(f="left"),g=parseInt(c.css(f)),b={},b[f]=g+d,c.css(b),c.show(),b[f]=g,c.animate(b,300,"easeOutCubic"),null},autofocus:!1},hide:{event:null,delay:0,effect:!1},position:{adjust:{method:"shift shift",scroll:!1}},style:{classes:"ui-tour-tip",tip:{height:i,width:h}},events:{},zindex:2e3},b.prototype.initialize=function(a){return a=$.extend(!0,{},this.QTIP_DEFAULTS,a),this.el.qtip(a),this.qtip=this.el.qtip("api"),this.qtip.render()},b.prototype.destroy=function(){return this.qtip&&this.qtip.destroy(),b.__super__.destroy.call(this)},b.prototype.show=function(){return this.qtip.show()},b.prototype.hide=function(){return this.qtip.hide()},b.prototype._getTipElement=function(){return $("#qtip-"+this.qtip.id)},b.prototype._setTarget=function(a,c){return b.__super__._setTarget.call(this,a,c),this.qtip.set("position.target",a||!1)},b.prototype._renderContent=function(a,b){var c,d,e=this;return d=a.my||"left center",c=a.at||"right center",this._adjustPlacement(d,c),this.qtip.set("content.text",b),this.qtip.set("position.container",a.container||$("body")),this.qtip.set("position.my",d),this.qtip.set("position.at",c),this.qtip.set("position.viewport",a.viewport||!1),this.qtip.set("position.target",a.target||!1),setTimeout(function(){return e._renderTipBackground(d.split(" ")[0])},10)},b.prototype._adjustPlacement=function(a){return 0===a.indexOf("top")?this._adjust(0,d):0===a.indexOf("bottom")?this._adjust(0,-d):0===a.indexOf("right")?this._adjust(-d,0):this._adjust(d,0)},b.prototype._adjust=function(a,b){return this.qtip.set("position.adjust.x",a),this.qtip.set("position.adjust.y",b)},b.prototype._renderTipBackground=function(a){var b,c;return c=$("#qtip-"+this.qtip.id+" .qtip-tip"),b=c.find(".qtip-tip-bg"),b.length||(b=$("",{"class":"icon icon-tip qtip-tip-bg"}),c.append(b)),b.removeClass("top left right bottom"),b.addClass(a)},b}(Tourist.Tip.Base),Tourist.Tip.Simple=function(a){function b(){return d=b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.initialize=function(){return $("body").append(this.el)},b.prototype.show=function(){return this.el.show()},b.prototype.hide=function(){return this.el.hide()},b.prototype._getTipElement=function(){return this.el},b.prototype._renderContent=function(a,b){return this.el.html(b)},b}(Tourist.Tip.Base),Tourist.Tour=function(){function a(a){var b,c;this.options=null!=a?a:{},this.onChangeCurrentStep=g(this.onChangeCurrentStep,this),this.next=g(this.next,this),b={tipClass:"Bootstrap"},this.options=_.extend(b,this.options),this.model=new Tourist.Model({current_step:null}),c=_.extend({model:this.model},this.options.tipOptions),this.view=new Tourist.Tip[this.options.tipClass](c),this.view.bind("click:close",_.bind(this.stop,this,!0)),this.view.bind("click:next",this.next),this.model.bind("change:current_step",this.onChangeCurrentStep)}return _.extend(a.prototype,Backbone.Events),a.prototype.start=function(){return this.trigger("start",this),this.next()},a.prototype.stop=function(a){return a?this._showCancelFinalStep():this._stop()},a.prototype.next=function(){var a,b;return a=this._teardownCurrentStep(),b=0,a&&(b=a.index+1),bc;c++)b=e[c],a[b]=_.bind(a[b],a,this,this.options.stepOptions);return a.setup.call(a,this,this.options.stepOptions)||{}},a.prototype._teardownStep=function(a){return a&&a.teardown&&a.teardown.call(a,this,this.options.stepOptions),this.view.cleanupCurrentTarget()},a}()}).call(this);
5 |
6 | }(jQuery));
--------------------------------------------------------------------------------
/inc/wc-plugin-settings.php:
--------------------------------------------------------------------------------
1 | id = 'mbot_settings';
11 |
12 | add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_tab' ), 50 );
13 | add_action( 'woocommerce_sections_' . $this->id, array( $this, 'output_sections' ) );
14 | add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) );
15 | add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) );
16 |
17 | }
18 |
19 | /**
20 | * Add plugin options tab
21 | *
22 | * @return array
23 | */
24 | public function add_settings_tab( $settings_tabs ) {
25 | $settings_tabs[$this->id] = __( 'Messenger Bot', 'woocommerce-settings-tab-demo' );
26 | return $settings_tabs;
27 | }
28 |
29 | /**
30 | * Get sections
31 | *
32 | * @return array
33 | */
34 | public function get_sections() {
35 |
36 | $sections = array(
37 | '' => __( 'API Credentials', 'mbot-woocommmerce' ),
38 | 'screen-settings' => __( 'Appearance', 'mbot-woocommmerce' ),
39 | 'messages' => __( 'Messages', 'mbot-woocommmerce' ),
40 | //'section 2' => __( 'Section 2', 'mbot-woocommmerce' ),
41 |
42 | );
43 |
44 | return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
45 | }
46 |
47 |
48 | /**
49 | * Get sections
50 | *
51 | * @return array
52 | */
53 | public function get_settings( $section = null ) {
54 |
55 | switch( $section ){
56 |
57 | case 'messages':
58 | $settings = array(
59 | 'section_title' => array(
60 | 'name' => __( 'Messages', 'mbot-woocommmerce' ),
61 | 'type' => 'title',
62 | 'desc' => '',
63 | 'id' => 'derweili_mbot_messages_title'
64 | ),
65 | 'new_order_message' => array(
66 | 'name' => __( 'New Order', 'mbot-woocommmerce' ),
67 | 'type' => 'text',
68 | 'desc' => __( 'This is the message the user will recieve when they placed the order.', 'mbot-woocommmerce' ),
69 | 'id' => 'derweili_mbot_new_order_message'
70 | ),
71 | 'pending_order_message' => array(
72 | 'name' => __( 'Pending Order', 'mbot-woocommmerce' ),
73 | 'type' => 'text',
74 | 'desc' => __( 'This is the message the user will recieve when the order status changed to "pending".', 'mbot-woocommmerce' ),
75 | 'id' => 'derweili_mbot_pending_order_message'
76 | ),
77 | 'failed_order_message' => array(
78 | 'name' => __( 'Failed Order', 'mbot-woocommmerce' ),
79 | 'type' => 'text',
80 | 'desc' => __( 'This is the message the user will recieve when the order failed.', 'mbot-woocommmerce' ),
81 | 'id' => 'derweili_mbot_failed_order_message'
82 | ),
83 | 'on_hold_message' => array(
84 | 'name' => __( 'On Hold', 'mbot-woocommmerce' ),
85 | 'type' => 'text',
86 | 'desc' => __( 'This is the message the user will recieve when the order gets the status "on hold".', 'mbot-woocommmerce' ),
87 | 'id' => 'derweili_mbot_on_hold_order_message'
88 | ),
89 | 'processing_message' => array(
90 | 'name' => __( 'Processing', 'mbot-woocommmerce' ),
91 | 'type' => 'text',
92 | 'desc' => __( 'This is the message the user will recieve when the order gets the status "processing".', 'mbot-woocommmerce' ),
93 | 'id' => 'derweili_mbot_processing_order_message'
94 | ),
95 | 'completed_message' => array(
96 | 'name' => __( 'Completed Order', 'mbot-woocommmerce' ),
97 | 'type' => 'text',
98 | 'desc' => __( 'This is the message the user will recieve when the order gets the status "completed".', 'mbot-woocommmerce' ),
99 | 'id' => 'derweili_mbot_completed_order_message'
100 | ),
101 | 'refunded_message' => array(
102 | 'name' => __( 'Refunded Order', 'mbot-woocommmerce' ),
103 | 'type' => 'text',
104 | 'desc' => __( 'This is the message the user will recieve when the order gets the status "refunded".', 'mbot-woocommmerce' ),
105 | 'id' => 'derweili_mbot_refunded_order_message'
106 | ),
107 | 'cancelled_message' => array(
108 | 'name' => __( 'Cancelled Order', 'mbot-woocommmerce' ),
109 | 'type' => 'text',
110 | 'desc' => __( 'This is the message the user will recieve when the order gets the status "cancelled".', 'mbot-woocommmerce' ),
111 | 'id' => 'derweili_mbot_cancelled_order_message'
112 | ),
113 | 'section_end' => array(
114 | 'type' => 'sectionend',
115 | 'id' => 'wc_settings_tab_demo_section_end_section-2'
116 | )
117 | );
118 | break;
119 |
120 | case 'screen-settings':
121 |
122 |
123 | $settings = array(
124 | 'facebook_api_credentials_title' => array(
125 | 'name' => __( 'Appearance of the Facebook Messenger Plugins', 'mbot-woocommmerce' ),
126 | 'type' => 'title',
127 | //'desc' => __( 'Your Callback URL is:', 'mbot-woocommmerce' ) . ' ' . get_home_url() . '/mbot-callback-webhook/' . '
' . __( 'Following URLs are currently whitelisted for the use of the messenger checkbox plugin:
', 'mbot-woocommmerce' ) . derweili_get_whitelisted_domains() ,
128 | 'id' => 'derweili_mbot_fb_screen_settings_title'
129 | ),
130 | 'checkbox-size' => array(
131 | 'name' => __( 'Checkbox size', 'mbot-woocommmerce' ),
132 | 'type' => 'select',
133 | 'id' => 'derweili_mbot_checkbox_size',
134 | 'options' => array(
135 | 'small' => __('Small', 'mbot-woocommmerce' ) ,
136 | 'medium' => __('Medium', 'mbot-woocommerce' ),
137 | 'large' => __('Large', 'mbot-woocommere' ),
138 | 'standard' => __( 'Standard', 'mbot-wooocommerce' ),
139 | 'xlarge' => __('xLarge', 'mbot-woocommere' )
140 | )
141 | ),
142 |
143 | /*'checkbox-prechecked' => array(
144 | 'name' => __( 'precheck the checkbox', 'mbot-woocommmerce' ),
145 | 'type' => 'checkbox',
146 | //'desc' => __( 'Your Callback URL is:', 'mbot-woocommmerce' ) . ' ' . plugin_dir_url( __FILE__ ) . 'webhook.php' ,
147 | 'id' => 'derweili_mbot_fb_checkbox_prechecked'
148 | ),*/
149 | 'checkbox-prechecked' => array(
150 | 'name' => __( 'Initial checkbox status', 'mbot-woocommmerce' ),
151 | 'type' => 'select',
152 | 'id' => 'derweili_mbot_fb_checkbox_prechecked',
153 | 'options' => array(
154 | 'true' => __('Checked', 'mbot-woocommmerce' ) ,
155 | 'false' => __('Unchecked', 'mbot-woocommerce' ),
156 | )
157 | ),
158 | 'checkbox-login' => array(
159 | 'name' => __( 'Allow / disallow login', 'mbot-woocommmerce' ),
160 | 'type' => 'select',
161 | 'id' => 'derweili_mbot_fb_checkbox_allow_login',
162 | 'options' => array(
163 | 'true' => __( 'Allow Login', 'mbot-woocommmerce' ) ,
164 | 'false' => __( 'Disallow Login', 'mbot-woocommerce' ),
165 | )
166 | ),
167 | 'button-size' => array(
168 | 'name' => __( 'Send-to-Messenger Button size', 'mbot-woocommmerce' ),
169 | 'type' => 'select',
170 | 'id' => 'derweili_mbot_button_size',
171 | 'options' => array(
172 | 'large' => __('Large', 'mbot-woocommere' ),
173 | 'standard' => __( 'Standard', 'mbot-wooocommerce' ),
174 | 'xlarge' => __('xLarge', 'mbot-woocommere' )
175 | )
176 | ),
177 | 'send-to-messenger-color' => array(
178 | 'name' => __( 'Send to Messenger Button color', 'mbot-woocommmerce' ),
179 | 'type' => 'select',
180 | 'id' => 'derweili_mbot_button_color',
181 | 'options' => array(
182 | 'blue' => __('Blue', 'mbot-woocommerce' ),
183 | 'white' => __('White', 'mbot-woocommerce')
184 | )
185 | ),
186 | 'send-to-messenger-login' => array(
187 | 'name' => __( 'Send-to-Messenger User Login', 'mbot-woocommmerce' ),
188 | 'type' => 'select',
189 | 'id' => 'derweili_mbot_button_enforce_login',
190 | 'options' => array(
191 | 'true' => __('Enforce Login for every user', 'mbot-woocommerce' ),
192 | 'false' => __('Enable Login only for logged out users', 'mbot-woocommerce' )
193 | )
194 | ),
195 | 'section_end' => array(
196 | 'type' => 'sectionend',
197 | 'id' => 'wc_mbot_settings_section_end'
198 | )
199 | );
200 |
201 |
202 |
203 | break;
204 |
205 | default : // API Credentials
206 |
207 | $settings = array(
208 | 'facebook_api_credentials_title' => array(
209 | 'name' => __( 'Facebook API Credentials', 'mbot-woocommmerce' ),
210 | 'type' => 'title',
211 | 'desc' => __( 'Your Callback URL is:', 'mbot-woocommmerce' ) . ' ' . get_home_url() . '/mbot-callback-webhook/' . '
' . __( 'Following URLs are currently whitelisted for the use of the messenger checkbox plugin:
', 'mbot-woocommmerce' ) . derweili_get_whitelisted_domains() . flush_rewrite_rules(),
212 | 'id' => 'derweili_mbot_fb_credentials_title'
213 | ),
214 | 'Page_ID' => array(
215 | 'name' => __( 'Page ID', 'mbot-woocommmerce' ),
216 | 'type' => 'text',
217 | 'desc' => __( '', 'mbot-woocommmerce' ),
218 | 'id' => 'derweili_mbot_page_id'
219 | ),
220 | 'Messenger_APP_ID' => array(
221 | 'name' => __( 'Messenger App ID', 'mbot-woocommmerce' ),
222 | 'type' => 'text',
223 | 'desc' => __( '', 'mbot-woocommmerce' ),
224 | 'id' => 'derweili_mbot_messenger_app_id'
225 | ),
226 | 'page_token' => array(
227 | 'name' => __( 'Page Tooken', 'mbot-woocommmerce' ),
228 | 'type' => 'text',
229 | 'desc' => __( '', 'mbot-woocommmerce' ),
230 | 'id' => 'derweili_mbot_page_token'
231 | ),
232 | 'verify_tooken' => array(
233 | 'name' => __( 'Verify Token', 'mbot-woocommmerce' ),
234 | 'type' => 'text',
235 | 'desc' => __( '', 'mbot-woocommmerce' ),
236 | 'id' => 'derweili_mbot_verify_token'
237 | ),
238 | /* 'checkbox-prechecked' => array(
239 | 'name' => __( 'Precheck checkbox?', 'mbot-woocommmerce' ),
240 | 'type' => 'checkbox',
241 | //'desc' => __( 'Your Callback URL is:', 'mbot-woocommmerce' ) . ' ' . plugin_dir_url( __FILE__ ) . 'webhook.php' ,
242 | 'id' => 'derweili_mbot_fb_checkbox_prechecked'
243 | ),
244 | 'checkbox-allow-login' => array(
245 | 'name' => __( 'Allow Login', 'mbot-woocommmerce' ),
246 | 'type' => 'checkbox',
247 | //'desc' => __( 'Your Callback URL is:', 'mbot-woocommmerce' ) . ' ' . plugin_dir_url( __FILE__ ) . 'webhook.php' ,
248 | 'id' => 'derweili_mbot_fb_checkbox_allow_login'
249 | ),*/
250 | 'section_end' => array(
251 | 'type' => 'sectionend',
252 | 'id' => 'wc_mbot_settings_section_end'
253 | )
254 | );
255 | break;
256 |
257 | }
258 |
259 | return apply_filters( 'wc_settings_tab_demo_settings', $settings, $section );
260 |
261 | }
262 |
263 | /**
264 | * Output the settings
265 | */
266 | public function output() {
267 | global $current_section;
268 | $settings = $this->get_settings( $current_section );
269 | WC_Admin_Settings::output_fields( $settings );
270 | }
271 |
272 |
273 | /**
274 | * Save settings
275 | */
276 | public function save() {
277 | global $current_section;
278 | $settings = $this->get_settings( $current_section );
279 | WC_Admin_Settings::save_fields( $settings );
280 | }
281 |
282 | }
283 |
284 | return new WC_Settings_My_Plugin();
--------------------------------------------------------------------------------
/css/jquery.qtip.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * qTip2 - Pretty powerful tooltips - v2.0.1-27-
3 | * http://qtip2.com
4 | *
5 | * Copyright (c) 2013 Craig Michael Thompson
6 | * Released under the MIT, GPL licenses
7 | * http://jquery.org/license
8 | *
9 | * Date: Tue Feb 26 2013 11:17 GMT+0000
10 | * Plugins: svg ajax tips modal viewport imagemap ie6
11 | * Styles: basic css3
12 | */
13 |
14 | /* Core qTip styles */
15 | .qtip, .qtip{
16 | position: absolute;
17 | left: -28000px;
18 | top: -28000px;
19 | display: none;
20 |
21 | max-width: 280px;
22 | min-width: 50px;
23 |
24 | font-size: 10.5px;
25 | line-height: 12px;
26 |
27 | direction: ltr;
28 | }
29 |
30 | .qtip-content{
31 | position: relative;
32 | padding: 5px 9px;
33 | overflow: hidden;
34 |
35 | text-align: left;
36 | word-wrap: break-word;
37 | }
38 |
39 | .qtip-titlebar{
40 | position: relative;
41 | padding: 5px 35px 5px 10px;
42 | overflow: hidden;
43 |
44 | border-width: 0 0 1px;
45 | font-weight: bold;
46 | }
47 |
48 | .qtip-titlebar + .qtip-content{ border-top-width: 0 !important; }
49 |
50 | /* Default close button class */
51 | .qtip-close{
52 | position: absolute;
53 | right: -9px; top: -9px;
54 |
55 | cursor: pointer;
56 | outline: medium none;
57 |
58 | border-width: 1px;
59 | border-style: solid;
60 | border-color: transparent;
61 | }
62 |
63 | .qtip-titlebar .qtip-close{
64 | right: 4px; top: 50%;
65 | margin-top: -9px;
66 | }
67 |
68 | * html .qtip-titlebar .qtip-close{ top: 16px; } /* IE fix */
69 |
70 | .qtip-titlebar .ui-icon,
71 | .qtip-icon .ui-icon{
72 | display: block;
73 | text-indent: -1000em;
74 | direction: ltr;
75 | vertical-align: middle;
76 | }
77 |
78 | .qtip-icon, .qtip-icon .ui-icon{
79 | -moz-border-radius: 3px;
80 | -webkit-border-radius: 3px;
81 | border-radius: 3px;
82 | text-decoration: none;
83 | }
84 |
85 | .qtip-icon .ui-icon{
86 | width: 18px;
87 | height: 14px;
88 |
89 | text-align: center;
90 | text-indent: 0;
91 | font: normal bold 10px/13px Tahoma,sans-serif;
92 |
93 | color: inherit;
94 | background: transparent none no-repeat -100em -100em;
95 | }
96 |
97 |
98 | /* Applied to 'focused' tooltips e.g. most recently displayed/interacted with */
99 | .qtip-focus{}
100 |
101 | /* Applied on hover of tooltips i.e. added/removed on mouseenter/mouseleave respectively */
102 | .qtip-hover{}
103 |
104 | /* Default tooltip style */
105 | .qtip-default{
106 | border-width: 1px;
107 | border-style: solid;
108 | border-color: #F1D031;
109 |
110 | background-color: #FFFFA3;
111 | color: #555;
112 | }
113 |
114 | .qtip-default .qtip-titlebar{
115 | background-color: #FFEF93;
116 | }
117 |
118 | .qtip-default .qtip-icon{
119 | border-color: #CCC;
120 | background: #F1F1F1;
121 | color: #777;
122 | }
123 |
124 | .qtip-default .qtip-titlebar .qtip-close{
125 | border-color: #AAA;
126 | color: #111;
127 | }
128 |
129 |
130 | /*! Light tooltip style */
131 | .qtip-light{
132 | background-color: white;
133 | border-color: #E2E2E2;
134 | color: #454545;
135 | }
136 |
137 | .qtip-light .qtip-titlebar{
138 | background-color: #f1f1f1;
139 | }
140 |
141 |
142 | /*! Dark tooltip style */
143 | .qtip-dark{
144 | background-color: #505050;
145 | border-color: #303030;
146 | color: #f3f3f3;
147 | }
148 |
149 | .qtip-dark .qtip-titlebar{
150 | background-color: #404040;
151 | }
152 |
153 | .qtip-dark .qtip-icon{
154 | border-color: #444;
155 | }
156 |
157 | .qtip-dark .qtip-titlebar .ui-state-hover{
158 | border-color: #303030;
159 | }
160 |
161 |
162 | /*! Cream tooltip style */
163 | .qtip-cream{
164 | background-color: #FBF7AA;
165 | border-color: #F9E98E;
166 | color: #A27D35;
167 | }
168 |
169 | .qtip-cream .qtip-titlebar{
170 | background-color: #F0DE7D;
171 | }
172 |
173 | .qtip-cream .qtip-close .qtip-icon{
174 | background-position: -82px 0;
175 | }
176 |
177 |
178 | /*! Red tooltip style */
179 | .qtip-red{
180 | background-color: #F78B83;
181 | border-color: #D95252;
182 | color: #912323;
183 | }
184 |
185 | .qtip-red .qtip-titlebar{
186 | background-color: #F06D65;
187 | }
188 |
189 | .qtip-red .qtip-close .qtip-icon{
190 | background-position: -102px 0;
191 | }
192 |
193 | .qtip-red .qtip-icon{
194 | border-color: #D95252;
195 | }
196 |
197 | .qtip-red .qtip-titlebar .ui-state-hover{
198 | border-color: #D95252;
199 | }
200 |
201 |
202 | /*! Green tooltip style */
203 | .qtip-green{
204 | background-color: #CAED9E;
205 | border-color: #90D93F;
206 | color: #3F6219;
207 | }
208 |
209 | .qtip-green .qtip-titlebar{
210 | background-color: #B0DE78;
211 | }
212 |
213 | .qtip-green .qtip-close .qtip-icon{
214 | background-position: -42px 0;
215 | }
216 |
217 |
218 | /*! Blue tooltip style */
219 | .qtip-blue{
220 | background-color: #E5F6FE;
221 | border-color: #ADD9ED;
222 | color: #5E99BD;
223 | }
224 |
225 | .qtip-blue .qtip-titlebar{
226 | background-color: #D0E9F5;
227 | }
228 |
229 | .qtip-blue .qtip-close .qtip-icon{
230 | background-position: -2px 0;
231 | }
232 |
233 |
234 | /* Add shadows to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE9+, Safari 2+ */
235 | .qtip-shadow{
236 | -webkit-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
237 | -moz-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
238 | box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
239 | }
240 |
241 | /* Add rounded corners to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE9+, Safari 2+ */
242 | .qtip-rounded,
243 | .qtip-tipsy,
244 | .qtip-bootstrap{
245 | -moz-border-radius: 5px;
246 | -webkit-border-radius: 5px;
247 | border-radius: 5px;
248 | }
249 |
250 | .qtip-rounded .qtip-titlebar{
251 | -moz-border-radius: 5px 5px 0 0;
252 | -webkit-border-radius: 5px 5px 0 0;
253 | border-radius: 5px 5px 0 0;
254 | }
255 |
256 | /* Youtube tooltip style */
257 | .qtip-youtube{
258 | -moz-border-radius: 2px;
259 | -webkit-border-radius: 2px;
260 | border-radius: 2px;
261 |
262 | -webkit-box-shadow: 0 0 3px #333;
263 | -moz-box-shadow: 0 0 3px #333;
264 | box-shadow: 0 0 3px #333;
265 |
266 | color: white;
267 | border-width: 0;
268 |
269 | background: #4A4A4A;
270 | background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0,#4A4A4A),color-stop(100%,black));
271 | background-image: -webkit-linear-gradient(top,#4A4A4A 0,black 100%);
272 | background-image: -moz-linear-gradient(top,#4A4A4A 0,black 100%);
273 | background-image: -ms-linear-gradient(top,#4A4A4A 0,black 100%);
274 | background-image: -o-linear-gradient(top,#4A4A4A 0,black 100%);
275 | }
276 |
277 | .qtip-youtube .qtip-titlebar{
278 | background-color: #4A4A4A;
279 | background-color: rgba(0,0,0,0);
280 | }
281 |
282 | .qtip-youtube .qtip-content{
283 | padding: .75em;
284 | font: 12px arial,sans-serif;
285 |
286 | filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000);
287 | -ms-filter: "progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000);";
288 | }
289 |
290 | .qtip-youtube .qtip-icon{
291 | border-color: #222;
292 | }
293 |
294 | .qtip-youtube .qtip-titlebar .ui-state-hover{
295 | border-color: #303030;
296 | }
297 |
298 |
299 | /* jQuery TOOLS Tooltip style */
300 | .qtip-jtools{
301 | background: #232323;
302 | background: rgba(0, 0, 0, 0.7);
303 | background-image: -webkit-gradient(linear, left top, left bottom, from(#717171), to(#232323));
304 | background-image: -moz-linear-gradient(top, #717171, #232323);
305 | background-image: -webkit-linear-gradient(top, #717171, #232323);
306 | background-image: -ms-linear-gradient(top, #717171, #232323);
307 | background-image: -o-linear-gradient(top, #717171, #232323);
308 |
309 | border: 2px solid #ddd;
310 | border: 2px solid rgba(241,241,241,1);
311 |
312 | -moz-border-radius: 2px;
313 | -webkit-border-radius: 2px;
314 | border-radius: 2px;
315 |
316 | -webkit-box-shadow: 0 0 12px #333;
317 | -moz-box-shadow: 0 0 12px #333;
318 | box-shadow: 0 0 12px #333;
319 | }
320 |
321 | /* IE Specific */
322 | .qtip-jtools .qtip-titlebar{
323 | background-color: transparent;
324 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A);
325 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)";
326 | }
327 | .qtip-jtools .qtip-content{
328 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323);
329 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)";
330 | }
331 |
332 | .qtip-jtools .qtip-titlebar,
333 | .qtip-jtools .qtip-content{
334 | background: transparent;
335 | color: white;
336 | border: 0 dashed transparent;
337 | }
338 |
339 | .qtip-jtools .qtip-icon{
340 | border-color: #555;
341 | }
342 |
343 | .qtip-jtools .qtip-titlebar .ui-state-hover{
344 | border-color: #333;
345 | }
346 |
347 |
348 | /* Cluetip style */
349 | .qtip-cluetip{
350 | -webkit-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
351 | -moz-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
352 | box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
353 |
354 | background-color: #D9D9C2;
355 | color: #111;
356 | border: 0 dashed transparent;
357 | }
358 |
359 | .qtip-cluetip .qtip-titlebar{
360 | background-color: #87876A;
361 | color: white;
362 | border: 0 dashed transparent;
363 | }
364 |
365 | .qtip-cluetip .qtip-icon{
366 | border-color: #808064;
367 | }
368 |
369 | .qtip-cluetip .qtip-titlebar .ui-state-hover{
370 | border-color: #696952;
371 | color: #696952;
372 | }
373 |
374 |
375 | /* Tipsy style */
376 | .qtip-tipsy{
377 | background: black;
378 | background: rgba(0, 0, 0, .87);
379 |
380 | color: white;
381 | border: 0 solid transparent;
382 |
383 | font-size: 11px;
384 | font-family: 'Lucida Grande', sans-serif;
385 | font-weight: bold;
386 | line-height: 16px;
387 | text-shadow: 0 1px black;
388 | }
389 |
390 | .qtip-tipsy .qtip-titlebar{
391 | padding: 6px 35px 0 10;
392 | background-color: transparent;
393 | }
394 |
395 | .qtip-tipsy .qtip-content{
396 | padding: 6px 10;
397 | }
398 |
399 | .qtip-tipsy .qtip-icon{
400 | border-color: #222;
401 | text-shadow: none;
402 | }
403 |
404 | .qtip-tipsy .qtip-titlebar .ui-state-hover{
405 | border-color: #303030;
406 | }
407 |
408 |
409 | /* Tipped style */
410 | .qtip-tipped{
411 | border: 3px solid #959FA9;
412 |
413 | -moz-border-radius: 3px;
414 | -webkit-border-radius: 3px;
415 | border-radius: 3px;
416 |
417 | background-color: #F9F9F9;
418 | color: #454545;
419 |
420 | font-weight: normal;
421 | font-family: serif;
422 | }
423 |
424 | .qtip-tipped .qtip-titlebar{
425 | border-bottom-width: 0;
426 |
427 | color: white;
428 | background: #3A79B8;
429 | background-image: -webkit-gradient(linear, left top, left bottom, from(#3A79B8), to(#2E629D));
430 | background-image: -webkit-linear-gradient(top, #3A79B8, #2E629D);
431 | background-image: -moz-linear-gradient(top, #3A79B8, #2E629D);
432 | background-image: -ms-linear-gradient(top, #3A79B8, #2E629D);
433 | background-image: -o-linear-gradient(top, #3A79B8, #2E629D);
434 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D);
435 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)";
436 | }
437 |
438 | .qtip-tipped .qtip-icon{
439 | border: 2px solid #285589;
440 | background: #285589;
441 | }
442 |
443 | .qtip-tipped .qtip-icon .ui-icon{
444 | background-color: #FBFBFB;
445 | color: #555;
446 | }
447 |
448 |
449 | /**
450 | * Twitter Bootstrap style.
451 | *
452 | * Tested with IE 8, IE 9, Chrome 18, Firefox 9, Opera 11.
453 | * Does not work with IE 7.
454 | */
455 | .qtip-bootstrap{
456 | /** Taken from Bootstrap body */
457 | font-size: 14px;
458 | line-height: 20px;
459 | color: #333333;
460 |
461 | /** Taken from Bootstrap .popover */
462 | padding: 1px;
463 | background-color: #ffffff;
464 | border: 1px solid #ccc;
465 | border: 1px solid rgba(0, 0, 0, 0.2);
466 | -webkit-border-radius: 6px;
467 | -moz-border-radius: 6px;
468 | border-radius: 6px;
469 | -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
470 | -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
471 | box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
472 | -webkit-background-clip: padding-box;
473 | -moz-background-clip: padding;
474 | background-clip: padding-box;
475 | }
476 |
477 | .qtip-bootstrap .qtip-titlebar{
478 | /** Taken from Bootstrap .popover-title */
479 | padding: 8px 14px;
480 | margin: 0;
481 | font-size: 14px;
482 | font-weight: normal;
483 | line-height: 18px;
484 | background-color: #f7f7f7;
485 | border-bottom: 1px solid #ebebeb;
486 | -webkit-border-radius: 5px 5px 0 0;
487 | -moz-border-radius: 5px 5px 0 0;
488 | border-radius: 5px 5px 0 0;
489 | }
490 |
491 | .qtip-bootstrap .qtip-titlebar .qtip-close{
492 | /**
493 | * Overrides qTip2:
494 | * .qtip-titlebar .qtip-close{
495 | * [...]
496 | * right: 4px;
497 | * top: 50%;
498 | * [...]
499 | * border-style: solid;
500 | * }
501 | */
502 | right: 11px;
503 | top: 45%;
504 | border-style: none;
505 | }
506 |
507 | .qtip-bootstrap .qtip-content{
508 | /** Taken from Bootstrap .popover-content */
509 | padding: 9px 14px;
510 | }
511 |
512 | .qtip-bootstrap .qtip-icon{
513 | /**
514 | * Overrides qTip2:
515 | * .qtip-default .qtip-icon {
516 | * border-color: #CCC;
517 | * background: #F1F1F1;
518 | * color: #777;
519 | * }
520 | */
521 | background: transparent;
522 | }
523 |
524 | .qtip-bootstrap .qtip-icon .ui-icon{
525 | /**
526 | * Overrides qTip2:
527 | * .qtip-icon .ui-icon{
528 | * width: 18px;
529 | * height: 14px;
530 | * }
531 | */
532 | width: auto;
533 | height: auto;
534 |
535 | /* Taken from Bootstrap .close */
536 | float: right;
537 | font-size: 20px;
538 | font-weight: bold;
539 | line-height: 18px;
540 | color: #000000;
541 | text-shadow: 0 1px 0 #ffffff;
542 | opacity: 0.2;
543 | filter: alpha(opacity=20);
544 | }
545 |
546 | .qtip-bootstrap .qtip-icon .ui-icon:hover{
547 | /* Taken from Bootstrap .close:hover */
548 | color: #000000;
549 | text-decoration: none;
550 | cursor: pointer;
551 | opacity: 0.4;
552 | filter: alpha(opacity=40);
553 | }
554 |
555 |
556 | /* IE9 fix - removes all filters */
557 | .qtip:not(.ie9haxors) div.qtip-content,
558 | .qtip:not(.ie9haxors) div.qtip-titlebar{
559 | filter: none;
560 | -ms-filter: none;
561 | }
562 |
563 |
564 | /* Tips plugin */
565 | .qtip .qtip-tip{
566 | margin: 0 auto;
567 | overflow: hidden;
568 | z-index: 10;
569 |
570 | }
571 |
572 | /* Opera bug #357 - Incorrect tip position
573 | https://github.com/Craga89/qTip2/issues/367 */
574 | x:-o-prefocus, .qtip .qtip-tip{
575 | visibility: hidden;
576 | }
577 |
578 | .qtip .qtip-tip,
579 | .qtip .qtip-tip .qtip-vml,
580 | .qtip .qtip-tip canvas{
581 | position: absolute;
582 |
583 | color: #123456;
584 | background: transparent;
585 | border: 0 dashed transparent;
586 | }
587 |
588 | .qtip .qtip-tip canvas{ top: 0; left: 0; }
589 |
590 | .qtip .qtip-tip .qtip-vml{
591 | behavior: url(#default#VML);
592 | display: inline-block;
593 | visibility: visible;
594 | }
595 | /* Modal plugin */
596 | #qtip-overlay{
597 | position: fixed;
598 | left: -10000em;
599 | top: -10000em;
600 | }
601 |
602 | /* Applied to modals with show.modal.blur set to true */
603 | #qtip-overlay.blurs{ cursor: pointer; }
604 |
605 | /* Change opacity of overlay here */
606 | #qtip-overlay div{
607 | position: absolute;
608 | left: 0; top: 0;
609 | width: 100%; height: 100%;
610 |
611 | background-color: black;
612 |
613 | opacity: 0.7;
614 | filter:alpha(opacity=70);
615 | -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
616 | }
617 |
618 |
619 | /* IE6 Modal plugin fix */
620 | .qtipmodal-ie6fix{
621 | position: absolute !important;
622 | }
--------------------------------------------------------------------------------
/js/backbone-min.js:
--------------------------------------------------------------------------------
1 | (function(t){var e=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,n){e.Backbone=t(e,n,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore"),r;try{r=require("jquery")}catch(n){}t(e,exports,i,r)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,r){var n=t.Backbone;var s=Array.prototype.slice;e.VERSION="1.3.3";e.$=r;e.noConflict=function(){t.Backbone=n;return this};e.emulateHTTP=false;e.emulateJSON=false;var a=function(t,e,r){switch(t){case 1:return function(){return i[e](this[r])};case 2:return function(t){return i[e](this[r],t)};case 3:return function(t,n){return i[e](this[r],o(t,this),n)};case 4:return function(t,n,s){return i[e](this[r],o(t,this),n,s)};default:return function(){var t=s.call(arguments);t.unshift(this[r]);return i[e].apply(i,t)}}};var h=function(t,e,r){i.each(e,function(e,n){if(i[n])t.prototype[n]=a(e,n,r)})};var o=function(t,e){if(i.isFunction(t))return t;if(i.isObject(t)&&!e._isModel(t))return l(t);if(i.isString(t))return function(e){return e.get(t)};return t};var l=function(t){var e=i.matches(t);return function(t){return e(t.attributes)}};var u=e.Events={};var c=/\s+/;var f=function(t,e,r,n,s){var a=0,h;if(r&&typeof r==="object"){if(n!==void 0&&"context"in s&&s.context===void 0)s.context=n;for(h=i.keys(r);athis.length)n=this.length;if(n<0)n+=this.length+1;var s=[];var a=[];var h=[];var o=[];var l={};var u=e.add;var c=e.merge;var f=e.remove;var d=false;var v=this.comparator&&n==null&&e.sort!==false;var g=i.isString(this.comparator)?this.comparator:null;var p,m;for(m=0;m7);this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(O,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";this.location.replace(e+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe");this.iframe.src="javascript:0";this.iframe.style.display="none";this.iframe.tabIndex=-1;var r=document.body;var n=r.insertBefore(this.iframe,r.firstChild).contentWindow;n.document.open();n.document.close();n.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState){s("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){s("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};if(this._usePushState){t("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){t("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getHash(this.iframe.contentWindow)}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){if(!this.matchRoot())return false;t=this.fragment=this.getFragment(t);return i.some(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};t=this.getFragment(t||"");var i=this.root;if(t===""||t.charAt(0)==="?"){i=i.slice(0,-1)||"/"}var r=i+t;t=this.decodeFragment(t.replace(U,""));if(this.fragment===t)return;this.fragment=t;if(this._usePushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,r)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var n=this.iframe.contentWindow;if(!e.replace){n.document.open();n.document.close()}this._updateHash(n.location,t,e.replace)}}else{return this.location.assign(r)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var q=function(t,e){var r=this;var n;if(t&&i.has(t,"constructor")){n=t.constructor}else{n=function(){return r.apply(this,arguments)}}i.extend(n,r,e);n.prototype=i.create(r.prototype,t);n.prototype.constructor=n;n.__super__=r.prototype;return n};y.extend=x.extend=$.extend=k.extend=N.extend=q;var F=function(){throw new Error('A "url" property or function must be specified')};var B=function(t,e){var i=e.error;e.error=function(r){if(i)i.call(e.context,t,r,e);t.trigger("error",t,r,e)}};return e});
2 | //# sourceMappingURL=backbone-min.map
--------------------------------------------------------------------------------