Plugin Directory

Changeset 2695994


Ignore:
Timestamp:
03/18/2022 02:14:09 PM (4 years ago)
Author:
outfunnel
Message:

Tagged v2.6.0

Location:
outfunnel
Files:
2 added
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • outfunnel/tags/2.6.0/commit.txt

    r2685827 r2695994  
    1 c48a1ffeeffd22fb5a36a9cf23715c5fba045c56
     1ab93104e9e4da7b017a0b30f888ad07b55381419
  • outfunnel/tags/2.6.0/forms/contactform7.php

    r2685827 r2695994  
    9393     */
    9494    public function run_webhook($contact_form, $abort, $submission) {
     95        Logger::info("Starting to process CF7 webhook");
     96
    9597        $outfunnel_settings = get_option('outfunnel_settings');
    9698
     
    101103        $of_api_key = $outfunnel_settings['of_api_key'];
    102104        $of_account_email = $outfunnel_settings['of_account_email'];
     105        $of_user_id = $outfunnel_settings['of_id'];
    103106
    104107        if (!$of_api_key || !$of_account_email) {
     108            Logger::warning("Failed to load Outfunnel settings");
     109
    105110            return false;
    106111        }
     
    115120        $posted_data = $submission->get_posted_data();
    116121        $form_url = get_permalink($submission->get_meta("container_post_id"));
     122
     123        Logger::info(
     124            "Starting to send a request",
     125            $of_user_id,
     126            [
     127                'form_name' => $form_name,
     128                'form_id' => $form_id
     129            ]
     130        );
    117131
    118132        $submission_data = array_map(function($formTag) use ($posted_data) {
     
    152166            'body' => wp_json_encode($webhook_data),
    153167        ]);
     168
     169        Logger::info("Webhook response", $of_user_id, ['response_code' => $response['response']['code']]);
    154170    }
    155171
  • outfunnel/tags/2.6.0/forms/elementor.php

    r2660741 r2695994  
    100100     */
    101101    public function run_webhook($record, $handler) {
     102        Logger::info("Starting to process Elementor webhook");
     103
    102104        $outfunnel_settings = get_option('outfunnel_settings');
    103105
    104106        if (!$outfunnel_settings) {
     107            Logger::warning("Failed to load Outfunnel settings");
     108
    105109            return;
    106110        }
     
    108112        $of_api_key = $outfunnel_settings['of_api_key'];
    109113        $of_account_email = $outfunnel_settings['of_account_email'];
     114        $of_user_id = $outfunnel_settings['of_id'];
    110115
    111116        if (!$of_api_key || !$of_account_email) {
     117            Logger::warning("Api key or account email missing", $of_user_id);
     118
    112119            return false;
    113120        }
     
    124131        $submission_time = $datetime->format('c');
    125132        $form_url = get_permalink(get_the_ID());
     133
     134        Logger::info(
     135            "Starting to send a request",
     136            $of_user_id,
     137            [
     138                'form_name' => $form_name,
     139                'form_id' => $form_id
     140            ]
     141        );
    126142
    127143        $webhook_data = [
     
    141157        ];
    142158
     159        Logger::info("Sending out webhook", $of_user_id);
     160
    143161        $response = wp_remote_post(OF_WEBHOOK_URL . '/webhooks/elementor', [
    144162            'headers' => [
     
    149167            'body' => wp_json_encode($webhook_data),
    150168        ]);
     169
     170        Logger::info("Webhook response", $of_user_id, ['response_code' => $response['response']['code']]);
    151171    }
    152172
  • outfunnel/tags/2.6.0/forms/gravityplugin.php

    r2638945 r2695994  
    8484     */
    8585    public function run_webhook($entry, $form) {
     86        Logger::info("Starting to process Gravity webhook");
     87
    8688        $outfunnel_settings = get_option('outfunnel_settings');
    8789
    8890        if (!$outfunnel_settings) {
     91            Logger::warning("Failed to load Outfunnel settings");
     92
    8993            return;
    9094        }
     
    9296        $of_api_key = $outfunnel_settings['of_api_key'];
    9397        $of_account_email = $outfunnel_settings['of_account_email'];
     98        $of_user_id = $outfunnel_settings['of_id'];
    9499
    95100        if (!$of_api_key || !$of_account_email) {
     101            Logger::warning("Api key or account email missing", $of_user_id);
     102
    96103            return false;
    97104        }
     
    120127            'body' => wp_json_encode($webhook_data),
    121128        ]);
     129
     130        Logger::info("Webhook response", $of_user_id, ['response_code' => $response['response']['code']]);
    122131    }
    123132
  • outfunnel/tags/2.6.0/languages/outfunnel.pot

    r2685827 r2695994  
    77msgid ""
    88msgstr ""
    9 "Project-Id-Version: outfunnel 2.5.0\n"
     9"Project-Id-Version: outfunnel 2.6.0\n"
    1010"Report-Msgid-Bugs-To: devel@outfunnel.com\n"
    11 "POT-Creation-Date: 2022-02-28 09:01+0000\n"
     11"POT-Creation-Date: 2022-03-18 14:14+0000\n"
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1818"Content-Transfer-Encoding: 8bit\n"
    1919
    20 #: outfunnel.php:129
     20#: outfunnel.php:104 outfunnel.php:353
     21msgid "Something went wrong"
     22msgstr ""
     23
     24#: outfunnel.php:168
    2125msgid "Settings"
    2226msgstr ""
    2327
    24 #: outfunnel.php:189
     28#: outfunnel.php:228
    2529msgid "Outfunnel"
    2630msgstr ""
    2731
    28 #: outfunnel.php:200
     32#: outfunnel.php:239
    2933msgid "Web tracking configuration"
    3034msgstr ""
    3135
    32 #: outfunnel.php:207
     36#: outfunnel.php:246
    3337msgid "Tracking ID"
    3438msgstr ""
    3539
    36 #: outfunnel.php:215
     40#: outfunnel.php:254
    3741msgid "Web forms integration"
    3842msgstr ""
    3943
    40 #: outfunnel.php:222
     44#: outfunnel.php:261
    4145msgid "Account email"
    4246msgstr ""
    4347
    44 #: outfunnel.php:230
     48#: outfunnel.php:269
    4549msgid "API key"
    4650msgstr ""
    4751
    48 #: outfunnel.php:267
     52#: outfunnel.php:277
     53msgid "Logging"
     54msgstr ""
     55
     56#: outfunnel.php:322
    4957#, php-format
    5058msgid ""
     
    5361msgstr ""
    5462
    55 #: outfunnel.php:298
    56 msgid "Something went wrong"
    57 msgstr ""
    58 
    59 #: outfunnel.php:323
     63#: outfunnel.php:386
    6064#, php-format
    6165msgid ""
     
    6569msgstr ""
    6670
    67 #: outfunnel.php:331
     71#: outfunnel.php:394
    6872msgid "Enter your Outfunnel Tracking ID for this website"
    6973msgstr ""
    7074
    71 #: outfunnel.php:339
     75#: outfunnel.php:402
    7276#, php-format
    7377msgid ""
     
    7781msgstr ""
    7882
    79 #: outfunnel.php:347
     83#: outfunnel.php:414
    8084msgid "Enter your Outfunnel account email"
    8185msgstr ""
    8286
    83 #: outfunnel.php:356
     87#: outfunnel.php:430
    8488msgid "Enter your Outfunnel API key"
    8589msgstr ""
  • outfunnel/tags/2.6.0/outfunnel.php

    r2685827 r2695994  
    22/*
    33Plugin Name: Outfunnel: Web Visitor Tracking & CRM Integration
    4 Version: 2.5.0
     4Version: 2.6.0
    55Author: andrisreinman
    66Author URI: https://outfunnel.com/
     
    1616use Outfunnel\Forms\GravityPlugin;
    1717use Outfunnel\Forms\Form;
     18use Outfunnel\Forms\Logger;
    1819
    1920include 'autoloader.php';
     
    2728    class OUTFUNNEL {
    2829
    29         public $plugin_version = '2.5.0';
     30        public $plugin_version = '2.6.0';
    3031
    3132        /**
     
    9091        }
    9192
     93        private function get_logging_data($of_account_email, $of_api_key) {
     94            $response = wp_remote_get(OF_API_URL . '/v1/wordpress/config', [
     95                'headers' => [
     96                    'Content-Type' => 'application/json',
     97                    'x-account-email' => $of_account_email,
     98                    'x-api-key' => $of_api_key
     99                ],
     100            ]);
     101
     102            if (!in_array($response['response']['code'], [200, 201], true)) {
     103                $type = 'error';
     104                $message = __('Something went wrong', OF_TEXT_DOMAIN);
     105                $body = json_decode($response['body']);
     106
     107                if (count($body->errors)) {
     108                    $message = $body->errors[0]->message;
     109                }
     110
     111                add_settings_error(
     112                    'outfunnel_settings',
     113                    esc_attr('settings_updated'),
     114                    $message,
     115                    $type
     116                );
     117
     118                return null;
     119            }
     120
     121            $response_payload = json_decode($response['body'], true)['data'];
     122
     123            return [
     124                'logging_url' => $response_payload['loggingUrl'],
     125                'logging_api_key' => $response_payload['apiKey'],
     126                'expires_at' => $response_payload['expiresAt']
     127            ];
     128        }
     129
    92130        public function plugin_includes() {
    93131            if (is_admin()) {
     
    112150        public function plugins_loaded_handler() {
    113151            load_plugin_textdomain('outfunnel', false, dirname(plugin_basename(__FILE__)) . '/languages/');
     152
    114153            $this->elementor = Elementor::instance();
    115154            $this->contact_form_7 = ContactForm7::instance();
     
    233272                'outfunnel_forms_section'
    234273            );
     274
     275            add_settings_section(
     276                'outfunnel_log_section',
     277                __('Logging', 'outfunnel'),
     278                [$this, 'outfunnel_log_settings_section_callback'],
     279                'outfunnelpage'
     280            );
     281
     282            add_settings_field(
     283                'of_enable_logging',
     284                'Enable Logging',
     285                [$this, 'of_enable_logging'],
     286                'outfunnelpage',
     287                'outfunnel_log_section'
     288            );
     289
    235290        }
    236291
     
    314369            }
    315370
     371            if (!empty($data['of_enable_logging'])) {
     372                $logging_data = $this::get_logging_data($data['of_account_email'], $data['of_api_key']);
     373
     374                $data['logging_url'] = $logging_data['logging_url'];
     375                $data['logging_api_key'] = $logging_data['logging_api_key'];
     376                $data['logging_api_key_expiration'] = $logging_data['expires_at'];
     377            }
     378
    316379            return $data;
    317380        }
     
    340403        }
    341404
     405        public function outfunnel_log_settings_section_callback() {
     406            echo wp_kses('Enable sending logs to Outfunnel', []);
     407        }
     408
    342409        public function of_account_email_field() {
    343410            $outfunnel_settings = get_option('outfunnel_settings');
     
    347414            <p class="description"><?=__('Enter your Outfunnel account email', OF_TEXT_DOMAIN);?></p>
    348415            <?php
     416        }
     417
     418        public function of_enable_logging() {
     419            $outfunnel_settings = get_option('outfunnel_settings');
     420            $of_enable_logging = isset($outfunnel_settings['of_enable_logging']) && $outfunnel_settings['of_enable_logging'] === "on";
     421
     422            echo '<input type="checkbox" name="outfunnel_settings[of_enable_logging]"' . checked( 1, $of_enable_logging, false ) . '/>';
    349423        }
    350424
  • outfunnel/tags/2.6.0/readme.txt

    r2685827 r2695994  
    33Tags: outfunnel, pipedrive, hubspot crm, copper, copper crm, mailchimp, activecampaign, gravity forms, contact form 7, elementor, elementor forms, web visitor tracking
    44Requires at least: 4.2
    5 Tested up to: 5.9.1
    6 Stable tag: 2.5.0
     5Tested up to: 5.9.2
     6Stable tag: 2.6.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4545
    4646== Changelog ==
     47
     48= 2.6.0 =
     49
     50* Enable debug logging
    4751
    4852= 2.5.0 =
  • outfunnel/trunk/commit.txt

    r2685827 r2695994  
    1 c48a1ffeeffd22fb5a36a9cf23715c5fba045c56
     1ab93104e9e4da7b017a0b30f888ad07b55381419
  • outfunnel/trunk/forms/contactform7.php

    r2685827 r2695994  
    9393     */
    9494    public function run_webhook($contact_form, $abort, $submission) {
     95        Logger::info("Starting to process CF7 webhook");
     96
    9597        $outfunnel_settings = get_option('outfunnel_settings');
    9698
     
    101103        $of_api_key = $outfunnel_settings['of_api_key'];
    102104        $of_account_email = $outfunnel_settings['of_account_email'];
     105        $of_user_id = $outfunnel_settings['of_id'];
    103106
    104107        if (!$of_api_key || !$of_account_email) {
     108            Logger::warning("Failed to load Outfunnel settings");
     109
    105110            return false;
    106111        }
     
    115120        $posted_data = $submission->get_posted_data();
    116121        $form_url = get_permalink($submission->get_meta("container_post_id"));
     122
     123        Logger::info(
     124            "Starting to send a request",
     125            $of_user_id,
     126            [
     127                'form_name' => $form_name,
     128                'form_id' => $form_id
     129            ]
     130        );
    117131
    118132        $submission_data = array_map(function($formTag) use ($posted_data) {
     
    152166            'body' => wp_json_encode($webhook_data),
    153167        ]);
     168
     169        Logger::info("Webhook response", $of_user_id, ['response_code' => $response['response']['code']]);
    154170    }
    155171
  • outfunnel/trunk/forms/elementor.php

    r2660741 r2695994  
    100100     */
    101101    public function run_webhook($record, $handler) {
     102        Logger::info("Starting to process Elementor webhook");
     103
    102104        $outfunnel_settings = get_option('outfunnel_settings');
    103105
    104106        if (!$outfunnel_settings) {
     107            Logger::warning("Failed to load Outfunnel settings");
     108
    105109            return;
    106110        }
     
    108112        $of_api_key = $outfunnel_settings['of_api_key'];
    109113        $of_account_email = $outfunnel_settings['of_account_email'];
     114        $of_user_id = $outfunnel_settings['of_id'];
    110115
    111116        if (!$of_api_key || !$of_account_email) {
     117            Logger::warning("Api key or account email missing", $of_user_id);
     118
    112119            return false;
    113120        }
     
    124131        $submission_time = $datetime->format('c');
    125132        $form_url = get_permalink(get_the_ID());
     133
     134        Logger::info(
     135            "Starting to send a request",
     136            $of_user_id,
     137            [
     138                'form_name' => $form_name,
     139                'form_id' => $form_id
     140            ]
     141        );
    126142
    127143        $webhook_data = [
     
    141157        ];
    142158
     159        Logger::info("Sending out webhook", $of_user_id);
     160
    143161        $response = wp_remote_post(OF_WEBHOOK_URL . '/webhooks/elementor', [
    144162            'headers' => [
     
    149167            'body' => wp_json_encode($webhook_data),
    150168        ]);
     169
     170        Logger::info("Webhook response", $of_user_id, ['response_code' => $response['response']['code']]);
    151171    }
    152172
  • outfunnel/trunk/forms/gravityplugin.php

    r2638945 r2695994  
    8484     */
    8585    public function run_webhook($entry, $form) {
     86        Logger::info("Starting to process Gravity webhook");
     87
    8688        $outfunnel_settings = get_option('outfunnel_settings');
    8789
    8890        if (!$outfunnel_settings) {
     91            Logger::warning("Failed to load Outfunnel settings");
     92
    8993            return;
    9094        }
     
    9296        $of_api_key = $outfunnel_settings['of_api_key'];
    9397        $of_account_email = $outfunnel_settings['of_account_email'];
     98        $of_user_id = $outfunnel_settings['of_id'];
    9499
    95100        if (!$of_api_key || !$of_account_email) {
     101            Logger::warning("Api key or account email missing", $of_user_id);
     102
    96103            return false;
    97104        }
     
    120127            'body' => wp_json_encode($webhook_data),
    121128        ]);
     129
     130        Logger::info("Webhook response", $of_user_id, ['response_code' => $response['response']['code']]);
    122131    }
    123132
  • outfunnel/trunk/languages/outfunnel.pot

    r2685827 r2695994  
    77msgid ""
    88msgstr ""
    9 "Project-Id-Version: outfunnel 2.5.0\n"
     9"Project-Id-Version: outfunnel 2.6.0\n"
    1010"Report-Msgid-Bugs-To: devel@outfunnel.com\n"
    11 "POT-Creation-Date: 2022-02-28 09:01+0000\n"
     11"POT-Creation-Date: 2022-03-18 14:14+0000\n"
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1818"Content-Transfer-Encoding: 8bit\n"
    1919
    20 #: outfunnel.php:129
     20#: outfunnel.php:104 outfunnel.php:353
     21msgid "Something went wrong"
     22msgstr ""
     23
     24#: outfunnel.php:168
    2125msgid "Settings"
    2226msgstr ""
    2327
    24 #: outfunnel.php:189
     28#: outfunnel.php:228
    2529msgid "Outfunnel"
    2630msgstr ""
    2731
    28 #: outfunnel.php:200
     32#: outfunnel.php:239
    2933msgid "Web tracking configuration"
    3034msgstr ""
    3135
    32 #: outfunnel.php:207
     36#: outfunnel.php:246
    3337msgid "Tracking ID"
    3438msgstr ""
    3539
    36 #: outfunnel.php:215
     40#: outfunnel.php:254
    3741msgid "Web forms integration"
    3842msgstr ""
    3943
    40 #: outfunnel.php:222
     44#: outfunnel.php:261
    4145msgid "Account email"
    4246msgstr ""
    4347
    44 #: outfunnel.php:230
     48#: outfunnel.php:269
    4549msgid "API key"
    4650msgstr ""
    4751
    48 #: outfunnel.php:267
     52#: outfunnel.php:277
     53msgid "Logging"
     54msgstr ""
     55
     56#: outfunnel.php:322
    4957#, php-format
    5058msgid ""
     
    5361msgstr ""
    5462
    55 #: outfunnel.php:298
    56 msgid "Something went wrong"
    57 msgstr ""
    58 
    59 #: outfunnel.php:323
     63#: outfunnel.php:386
    6064#, php-format
    6165msgid ""
     
    6569msgstr ""
    6670
    67 #: outfunnel.php:331
     71#: outfunnel.php:394
    6872msgid "Enter your Outfunnel Tracking ID for this website"
    6973msgstr ""
    7074
    71 #: outfunnel.php:339
     75#: outfunnel.php:402
    7276#, php-format
    7377msgid ""
     
    7781msgstr ""
    7882
    79 #: outfunnel.php:347
     83#: outfunnel.php:414
    8084msgid "Enter your Outfunnel account email"
    8185msgstr ""
    8286
    83 #: outfunnel.php:356
     87#: outfunnel.php:430
    8488msgid "Enter your Outfunnel API key"
    8589msgstr ""
  • outfunnel/trunk/outfunnel.php

    r2685827 r2695994  
    22/*
    33Plugin Name: Outfunnel: Web Visitor Tracking & CRM Integration
    4 Version: 2.5.0
     4Version: 2.6.0
    55Author: andrisreinman
    66Author URI: https://outfunnel.com/
     
    1616use Outfunnel\Forms\GravityPlugin;
    1717use Outfunnel\Forms\Form;
     18use Outfunnel\Forms\Logger;
    1819
    1920include 'autoloader.php';
     
    2728    class OUTFUNNEL {
    2829
    29         public $plugin_version = '2.5.0';
     30        public $plugin_version = '2.6.0';
    3031
    3132        /**
     
    9091        }
    9192
     93        private function get_logging_data($of_account_email, $of_api_key) {
     94            $response = wp_remote_get(OF_API_URL . '/v1/wordpress/config', [
     95                'headers' => [
     96                    'Content-Type' => 'application/json',
     97                    'x-account-email' => $of_account_email,
     98                    'x-api-key' => $of_api_key
     99                ],
     100            ]);
     101
     102            if (!in_array($response['response']['code'], [200, 201], true)) {
     103                $type = 'error';
     104                $message = __('Something went wrong', OF_TEXT_DOMAIN);
     105                $body = json_decode($response['body']);
     106
     107                if (count($body->errors)) {
     108                    $message = $body->errors[0]->message;
     109                }
     110
     111                add_settings_error(
     112                    'outfunnel_settings',
     113                    esc_attr('settings_updated'),
     114                    $message,
     115                    $type
     116                );
     117
     118                return null;
     119            }
     120
     121            $response_payload = json_decode($response['body'], true)['data'];
     122
     123            return [
     124                'logging_url' => $response_payload['loggingUrl'],
     125                'logging_api_key' => $response_payload['apiKey'],
     126                'expires_at' => $response_payload['expiresAt']
     127            ];
     128        }
     129
    92130        public function plugin_includes() {
    93131            if (is_admin()) {
     
    112150        public function plugins_loaded_handler() {
    113151            load_plugin_textdomain('outfunnel', false, dirname(plugin_basename(__FILE__)) . '/languages/');
     152
    114153            $this->elementor = Elementor::instance();
    115154            $this->contact_form_7 = ContactForm7::instance();
     
    233272                'outfunnel_forms_section'
    234273            );
     274
     275            add_settings_section(
     276                'outfunnel_log_section',
     277                __('Logging', 'outfunnel'),
     278                [$this, 'outfunnel_log_settings_section_callback'],
     279                'outfunnelpage'
     280            );
     281
     282            add_settings_field(
     283                'of_enable_logging',
     284                'Enable Logging',
     285                [$this, 'of_enable_logging'],
     286                'outfunnelpage',
     287                'outfunnel_log_section'
     288            );
     289
    235290        }
    236291
     
    314369            }
    315370
     371            if (!empty($data['of_enable_logging'])) {
     372                $logging_data = $this::get_logging_data($data['of_account_email'], $data['of_api_key']);
     373
     374                $data['logging_url'] = $logging_data['logging_url'];
     375                $data['logging_api_key'] = $logging_data['logging_api_key'];
     376                $data['logging_api_key_expiration'] = $logging_data['expires_at'];
     377            }
     378
    316379            return $data;
    317380        }
     
    340403        }
    341404
     405        public function outfunnel_log_settings_section_callback() {
     406            echo wp_kses('Enable sending logs to Outfunnel', []);
     407        }
     408
    342409        public function of_account_email_field() {
    343410            $outfunnel_settings = get_option('outfunnel_settings');
     
    347414            <p class="description"><?=__('Enter your Outfunnel account email', OF_TEXT_DOMAIN);?></p>
    348415            <?php
     416        }
     417
     418        public function of_enable_logging() {
     419            $outfunnel_settings = get_option('outfunnel_settings');
     420            $of_enable_logging = isset($outfunnel_settings['of_enable_logging']) && $outfunnel_settings['of_enable_logging'] === "on";
     421
     422            echo '<input type="checkbox" name="outfunnel_settings[of_enable_logging]"' . checked( 1, $of_enable_logging, false ) . '/>';
    349423        }
    350424
  • outfunnel/trunk/readme.txt

    r2685827 r2695994  
    33Tags: outfunnel, pipedrive, hubspot crm, copper, copper crm, mailchimp, activecampaign, gravity forms, contact form 7, elementor, elementor forms, web visitor tracking
    44Requires at least: 4.2
    5 Tested up to: 5.9.1
    6 Stable tag: 2.5.0
     5Tested up to: 5.9.2
     6Stable tag: 2.6.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4545
    4646== Changelog ==
     47
     48= 2.6.0 =
     49
     50* Enable debug logging
    4751
    4852= 2.5.0 =
Note: See TracChangeset for help on using the changeset viewer.