Plugin Directory

Changeset 3309840


Ignore:
Timestamp:
06/11/2025 01:41:47 PM (7 months ago)
Author:
plugcrux
Message:

Release 1.0.3 - updated plugin core files and documentation

Location:
integrate-with-zoho-campaigns
Files:
79 added
6 edited

Legend:

Unmodified
Added
Removed
  • integrate-with-zoho-campaigns/trunk/integrate-with-zoho-campaigns.php

    r3288319 r3309840  
    55 * Plugin URI: https://integrazo.com/products/integrate-with-zoho-campaigns
    66 * Description: Automatically send contact form submissions from popular WordPress forms to Zoho Campaigns and grow your business.
    7  * Version: 1.0.2
     7 * Version: 1.0.3
    88 * Author: Integrazo
    99 * Author URI: https://integrazo.com/
  • integrate-with-zoho-campaigns/trunk/readme.txt

    r3288319 r3309840  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1717The Integration for Zoho Campaigns plugin seamlessly integrates Contact Form 7, WPForms, Elementor Forms, Gravity Forms, and Formidable Forms with Zoho Campaigns. It automatically captures leads, subscribers, and form submissions, syncing them to your Zoho Campaigns mailing lists in real time.
    1818
    19 Watch the demo: https://www.youtube.com/watch?v=M5MKPvSrpD0
     19https://www.youtube.com/watch?v=M5MKPvSrpD0
    2020
    2121**Helpful Resources** 
     
    347347== Changelog ==
    348348
     349= 1.0.3 = 
     350**Fixed:** Elementor Forms field-loading issue
     351
    349352= 1.0.2 = 
    350353**Added:** Improved validation and sanitization 
  • integrate-with-zoho-campaigns/trunk/src/forms/form-fields.php

    r3261395 r3309840  
    315315        public function getElementorFormFields($form_id)
    316316        {
    317             global $wpdb;
    318 
    319             $form_fields = [];
    320 
    321             // Query to fetch Elementor form data and associated page titles
    322             $query = "
    323                SELECT m.post_id, m.meta_value, p.post_title
    324                FROM {$wpdb->postmeta} m
    325                INNER JOIN {$wpdb->posts} p ON m.post_id = p.ID
    326                WHERE m.meta_key = '_elementor_data' AND p.post_status = 'publish'
    327                LIMIT 30
    328            ";
    329             // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
    330             $results = $wpdb->get_results($query, ARRAY_A);
    331 
    332             foreach ($results as $result) {
    333                 // Decode the JSON stored in meta_value
    334                 $form_elements = json_decode($result['meta_value'], true);
    335 
    336                 if (is_array($form_elements)) {
    337                     foreach ($form_elements as $elements) {
    338                         if (is_array($elements)) {
    339                             foreach ($elements as $elementtemp) {
    340                                 if (is_array($elementtemp) || is_object($elementtemp)) {
    341                                     foreach ($elementtemp as $element) {
    342 
    343                                         // Check if $element is an array and has the 'id' key
    344                                         if (is_array($element) && isset($element['id'])) {
    345                                             // Check if 'settings' exists and has a 'form_name' key
    346                                             if ($form_id === $element['id']) {
    347                                                 if (!empty($element['settings']['form_fields']) && is_array($element['settings']['form_fields'])) {
    348                                                     foreach ($element['settings']['form_fields'] as $field) {
    349 
    350 
    351                                                         if (isset($field['field_label'])) {
    352                                                             // Ensure the necessary keys exist in the field array
    353                                                             $key = $field['custom_id']; // Use default empty string if not set
    354                                                             $label = $field['field_label']; // Use default empty string if not set
    355                                                             $type = $field['field_type'] ?? 'text'; // Default to 'text' if field_type is not set
    356 
    357                                                             $form_fields[] = [
    358                                                                 'key' => $key,       // Field slug
    359                                                                 'label' => $label,   // Field label
    360                                                                 'type' => $type,     // Field type
    361                                                                 'source' => 'form'   // Source type
    362                                                             ];
    363                                                         }
    364                                                     }
    365                                                 }
    366                                             }
    367                                         }
    368                                     }
    369                                 }
     317            $form_fields = [];
     318
     319            // ✅ Check if Elementor Pro class exists
     320            if (! class_exists('\ElementorPro\Modules\Forms\Submissions\Database\Repositories\Form_Snapshot_Repository')) {
     321                return $form_fields;
     322            }
     323
     324            try {
     325                $formsnaps = \ElementorPro\Modules\Forms\Submissions\Database\Repositories\Form_Snapshot_Repository::instance()->all();
     326
     327                foreach ($formsnaps as $form) {
     328                    if ($form->id === $form_id) {
     329                        // ✅ Found matching form ID → now get fields
     330                        if (!empty($form->fields) && is_array($form->fields)) {
     331                            foreach ($form->fields as $field) {
     332                                $form_fields[] = [
     333                                    'key'    => $field['id'] ?? '',
     334                                    'label'  => $field['label'] ?? '',
     335                                    'type'   => $field['type'] ?? 'text',
     336                                    'source' => 'form'
     337                                ];
    370338                            }
    371339                        }
    372                     }
    373                 }
    374             }
    375 
    376             return $form_fields;
     340                        break; // ✅ Form found → no need to check others
     341                    }
     342                }
     343                return $form_fields;
     344            } catch (Throwable $e) {
     345                return $form_fields;
     346            }
    377347        }
    378348        /**
  • integrate-with-zoho-campaigns/trunk/src/forms/form-group-ids.php

    r3261395 r3309840  
    272272        public function getElementorForms()
    273273        {
    274             global $wpdb;
    275 
    276274            $form_list = [];
    277             try {
    278                 // Query to fetch Elementor form data and associated page titles
    279                 $query = "
    280 SELECT m.post_id, m.meta_value, p.post_title
    281 FROM {$wpdb->postmeta} m
    282 INNER JOIN {$wpdb->posts} p ON m.post_id = p.ID
    283 WHERE m.meta_key = '_elementor_data' AND p.post_status = 'publish'
    284 LIMIT 30
    285 ";
    286                 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
    287                 $results = $wpdb->get_results($query, ARRAY_A);
    288 
    289                 foreach ($results as $result) {
    290                     // Decode the JSON stored in meta_value
    291                     $form_elements = json_decode($result['meta_value'], true);
    292 
    293                     if (is_array($form_elements)) {
    294                         foreach ($form_elements as $elements) {
    295                             if (is_array($elements)) {
    296                                 foreach ($elements as $elementtemp) {
    297 
    298                                     if (is_array($elementtemp) || is_object($elementtemp)) {
    299                                         foreach ($elementtemp as $element) {
    300 
    301                                             // Check if $element is an array and has the 'id' key
    302                                             if (is_array($element) && isset($element['id'])) {
    303                                                 // Check if 'settings' exists and has a 'form_name' key
    304 
    305                                                 // Proceed only if 'settings' is valid and contains 'form_name'
    306                                                 if (isset($element['settings']) && is_array($element['settings']) && isset($element['settings']['form_name'])) {
    307                                                     $form_name = $element['settings']['form_name'];
    308 
    309                                                     // Append to the form list
    310                                                     $form_list[] = [
    311                                                         'id'   => $element['id'],
    312                                                         'name' => $form_name . " - " . $result['post_title'],
    313                                                     ];
    314                                                 }
    315                                             }
    316                                         }
    317                                     }
    318                                 }
    319                             }
    320                         }
    321                     }
     275
     276            if (! class_exists('\ElementorPro\Modules\Forms\Submissions\Database\Repositories\Form_Snapshot_Repository')) {
     277                return $form_list; // Return empty if class not found
     278            }
     279
     280            try {
     281                $formsnaps = \ElementorPro\Modules\Forms\Submissions\Database\Repositories\Form_Snapshot_Repository::instance()->all();
     282
     283                foreach ($formsnaps as $form) {
     284                    $page_title = get_the_title($form->post_id);
     285
     286                    $form_list[] = [
     287                        'id'   => $form->id,
     288                        'name' => $form->name . ' - ' . $page_title,
     289                    ];
    322290                }
    323291
  • integrate-with-zoho-campaigns/trunk/src/forms/form-name.php

    r3261395 r3309840  
    117117        public function getElementorFormName($form_id)
    118118        {
    119             global $wpdb;
     119            // Return empty string by default
     120            $form_name = '';
    120121
    121             // Query to fetch Elementor form data and associated page titles
    122             $query = "
    123        SELECT m.post_id, m.meta_value, p.post_title
    124        FROM {$wpdb->postmeta} m
    125        INNER JOIN {$wpdb->posts} p ON m.post_id = p.ID
    126        WHERE m.meta_key = '_elementor_data' AND p.post_status = 'publish'
    127    ";
    128             // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
    129             $results = $wpdb->get_results($query, ARRAY_A);
     122            // ✅ Check if Elementor Pro class exists
     123            if (! class_exists('\ElementorPro\Modules\Forms\Submissions\Database\Repositories\Form_Snapshot_Repository')) {
     124                return $form_name;
     125            }
    130126
    131             if ($results) {
    132                 foreach ($results as $result) {
    133                     $form_elements = json_decode($result['meta_value'], true); // Decode JSON
     127            try {
     128                $formsnaps = \ElementorPro\Modules\Forms\Submissions\Database\Repositories\Form_Snapshot_Repository::instance()->all();
    134129
    135                     if (is_array($form_elements)) {
    136                         foreach ($form_elements as $element_group) {
    137                             if (is_array($element_group)) {
    138                                 foreach ($element_group['elements'] ?? [] as $element) {
    139                                     if (is_array($element) && isset($element['id'], $element['settings']['form_name'])) {
    140                                         // Match the form ID
    141                                         if ($element['id'] === $form_id) {
    142                                             return $element['settings']['form_name'] . " - " . $result['post_title'];
    143                                         }
    144                                     }
    145                                 }
    146                             }
    147                         }
     130                foreach ($formsnaps as $form) {
     131                    if ($form->id === $form_id) {
     132                        $page_title = get_the_title($form->post_id);
     133                        $form_name = $form->name . ' - ' . $page_title;
     134                        break; // Found → exit loop
    148135                    }
    149136                }
     137
     138                return $form_name;
     139            } catch (Throwable $e) {
     140                return $form_name; // return empty string if error
    150141            }
    151 
    152             return __('Unknown Form', 'integrate-with-zoho-campaigns');
    153142        }
    154 
    155 
    156143
    157144
  • integrate-with-zoho-campaigns/trunk/src/forms/submit-action.php

    r3261395 r3309840  
    365365            try {
    366366                // Retrieve form ID and group ID
    367                 $form_settings = $record->get('form_settings'); // Get form settings
    368                 $form_id = $form_settings['id'] ?? 'unknown_form_id'; // Retrieve the correct form ID
     367                $form_details = $handler->get_current_form();
     368                $form_id = $form_details['id'];
    369369                $form_group_id = 7; // Set form group ID for Elementor Forms
    370370                $session = iafwzcai_is_valid_key();
Note: See TracChangeset for help on using the changeset viewer.