Plugin Directory

Changeset 3222869


Ignore:
Timestamp:
01/15/2025 11:58:11 AM (15 months ago)
Author:
fromdoppler
Message:

update plugin version 2.4.4

Location:
doppler-form
Files:
187 added
8 edited

Legend:

Unmodified
Added
Removed
  • doppler-form/trunk/doppler-form.php

    r3218286 r3222869  
    1616 * Plugin Name:       Doppler Forms
    1717 * Description:       Crea Formularios de Suscripción con la misma estética de tu sitio web o blog en minutos. Conéctalo con Doppler y envía a tus nuevos contactos automáticamente a una Lista de Suscriptores.
    18  * Version:           2.4.3
     18 * Version:           2.4.4
    1919 * Author:            Doppler LLC
    2020 * Author URI:        https://www.fromdoppler.com/
     
    3030}
    3131
    32 if( !defined('DOPPLER_FORM_VERSION') ) define( 'DOPPLER_FORM_VERSION', '2.4.3' );
     32if( !defined('DOPPLER_FORM_VERSION') ) define( 'DOPPLER_FORM_VERSION', '2.4.4' );
    3333if( !defined('WP_DEBUG_LOG_DOPPLER_PLUGINS') ) define( 'WP_DEBUG_LOG_DOPPLER_PLUGINS', false );
    3434
  • doppler-form/trunk/includes/class-doppler-form-widget.php

    r2168369 r3222869  
    3333
    3434            $form['fields'] = DPLR_Field_Model::getBy(['form_id' => $instance['form_id']],['sort_order'], true);
    35             DPLR_Form_Helper::generate($form);
     35            echo DPLR_Form_Helper::generate($form);
    3636
    3737            echo $after_widget;
  • doppler-form/trunk/includes/class-doppler-form.php

    r3042650 r3222869  
    8282            ]);
    8383
    84          /* Not sure about this block. */
    85          try {
    86             //$this->doppler_service->setCredentials(['api_key' => $options['dplr_option_apikey'], 'user_account' => $options['dplr_option_useraccount']]);
    87          } catch (Exception $e) {;}
    88 
    89         // inicializar el shortcode aca:
    9084        $this->load_shortcodes();
    9185        $this->load_dependencies();
     
    278272            update_option('dplr_2_0_updated',1);
    279273
    280         }else{
    281 
     274        }
     275        else if(isset($settings['dplr_option_apikey']) && (!$db_version || version_compare($db_version,'2.5.0','<'))) {
     276            DPLR_Form_Model::init();
     277            update_option('dplr_version', $this->get_version());
     278        }
     279        else {
    282280            update_option('dplr_version', $this->get_version() );
    283        
    284281        }
    285    
    286282    }
    287283
  • doppler-form/trunk/includes/helpers/Form_Helper.php

    r3218286 r3222869  
    11<?php
     2require_once(plugin_dir_path( __FILE__ ) . "../enums/EventType.php");
    23
    34class DPLR_Form_helper
     
    1314        $form_class = isset($context['classes']) ? implode(" ", $context['classes']) : "";
    1415        $form_orientation_horizontal = isset($form->settings["form_orientation"]) && $form->settings["form_orientation"] === 'horizontal';
     16
     17        self::registerDisplayEvent($form->id);
    1518   
    1619        ob_start();
     
    506509        <?php
    507510        break;
    508     }
    509   }
     511        }
     512    }
     513
     514    private static function registerDisplayEvent($formId) {
     515        DPLR_Form_Model::insertEvent([
     516            'parent_id'=>$formId,
     517            'event_type' => EventType::DISPLAY,
     518            'event_date' => DPLR_Form_Model::now()
     519        ]);
     520    }
    510521}
    511522?>
  • doppler-form/trunk/includes/models/Base_Model.php

    r2230394 r3222869  
    99    $tablename = strtolower( get_called_class() );
    1010    $tablename = str_replace( '_model', '', $tablename );
     11    return $wpdb->prefix . $tablename;
     12  }
     13
     14  public static function _eventTable() {
     15    global $wpdb;
     16    $tablename = strtolower( get_called_class() );
     17    $tablename = str_replace( '_model', '_events', $tablename );
    1118    return $wpdb->prefix . $tablename;
    1219  }
     
    155162  }
    156163
     164  protected static function initEventsTable() {
     165    global $wpdb;
     166    $charset_collate = $wpdb->get_charset_collate();
     167
     168    $tablemame = self::_eventTable();
     169
     170    if($wpdb->get_var("SHOW TABLES LIKE '$tablemame'") != $tablemame) {
     171      $sql = "CREATE TABLE ". $eventablemametTableName . "("
     172         . "id mediumint(9) NOT NULL AUTO_INCREMENT,"
     173      . "parent_id mediumint(9) NOT NULL,"
     174      . "event_type TINYINT NOT NULL,"
     175      . "event_date DATETIME NOT NULL,"
     176      . "data TEXT NULL,"
     177      . "PRIMARY KEY (id),"
     178      . "FOREIGN KEY (parent_id) REFERENCES " . self::_table() . "(".self::$primary_key.") ON DELETE CASCADE"
     179      . ") $charset_collate;";
     180
     181      require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     182      dbDelta( $sql );
     183    }
     184  }
     185
     186  static function insertEvent( $data ) {
     187    global $wpdb;
     188    $wpdb->insert( self::_eventTable(), $data );
     189    return $wpdb->insert_id;
     190  }
    157191}
    158192?>
  • doppler-form/trunk/includes/models/Form_Model.php

    r2070147 r3222869  
    3030    self::initSettings();
    3131
     32    self::initEventsTable();
    3233  }
    33 
    34 }
    35 
    36  ?>
     34}?>
  • doppler-form/trunk/public/doppler-forms-public.php

    r3042650 r3222869  
    117117        try
    118118        {
    119 
    120119            $options = get_option('dplr_settings');
    121120            $this->doppler_service->setCredentials(['api_key' => $options['dplr_option_apikey'], 'user_account' => $options['dplr_option_useraccount']]);
     
    126125            $form_id = $_POST['form_id'];
    127126
    128             // traer la plantilla a utilizar en el mail.
    129127            $form = DPLR_Form_Model::get($form_id, true);
    130128            $subscriber["form_doble_optin"] = $form->settings["form_doble_optin"];
    131             // $form->settings["form_plantilla_id"] cuando se crea el formulario es NULL. Por ende hasta que no se actualiza con algun cambio luego de haberlo creado, no funciona el envio de email, porque al ser null el template, el endpoint tira error porque le falta ese parametro obligatorio.
    132129            $subscriber["form_plantilla_id"] = $form->settings["form_plantilla_id"];
    133130
     
    142139                $this->doppler_service->pluginLogger(array('action' => 'result submit_form', 'data' => $result), 'submit_form');
    143140            }
     141
     142            if (is_array($result) && isset($result['response']['code']) && $result['response']['code'] === 200) {
     143                self::registerSubmitEvent($form_id);
     144            }
     145
    144146            $this->doppler_service->pluginLogger(array( 'action' => 'finish submit_form'), 'submit_form');
    145147        }
     
    160162    }
    161163
     164    private static function registerSubmitEvent($formId) {
     165        require_once(plugin_dir_path( __FILE__ ) . "../includes/enums/EventType.php");
     166
     167        DPLR_Form_Model::insertEvent([
     168            'parent_id'=>$formId,
     169            'event_type' => EventType::SUBMIT,
     170            'event_date' => DPLR_Form_Model::now()
     171        ]);
     172    }
    162173}
  • doppler-form/trunk/readme.txt

    r3218286 r3222869  
    66Tested up to: 6.6.2
    77Requires PHP: 5.6.4
    8 Stable tag: 2.4.3
     8Stable tag: 2.4.4
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8989
    9090== Changelog ==
    91 = 2.4.2 =
     91= 2.4.4 =
     92* Fix: Fix form rendering when used as widget.
     93
     94= 2.4.3 =
    9295* Feat: Allow to display forms in a Elementor's pop up.
    9396
Note: See TracChangeset for help on using the changeset viewer.