PluginProbe
Repeater Fields for Gravity Forms / 2.3.2
Repeater Fields for Gravity Forms v2.3.2
3.2.0 3.1.1 3.1.0 3.0.4 3.0.3 3.0.2 3.0.1 3.0.0 2.5.1 2.5.0 2.4.6 trunk 2.0.5 2.0.9 2.1.0 2.3.2 2.3.7 2.4.1 2.4.3 2.4.4 2.4.5
← All changes | add_on.php +0 -112 2.4.62.3.2 View file →
@@ -1,112 +1,0 @@
1 -<?php
2 -if ( ! class_exists( 'GFForms' ) ) {
3 - die();
4 -}
5 -GFForms::include_addon_framework();
6 -class Superaddons_Grepeater_Field_Addon extends GFAddOn{
7 - protected $_version = "1.0";
8 - protected $_min_gravityforms_version = '1.9';
9 - protected $_slug = 'repeater-for-gravity-forms';
10 - protected $_path = 'repeater-for-gravity-forms/repeater-for-gravity-forms.php';
11 - protected $_full_path = __FILE__;
12 - protected $_title = 'Gravity Forms Repeater Fields Add-On';
13 - protected $_short_title = 'Gravity Repeater';
14 - private static $_instance = null;
15 - public static function get_instance() {
16 - if ( self::$_instance == null ) {
17 - self::$_instance = new self();
18 - }
19 - return self::$_instance;
20 - }
21 - public function init_admin() {
22 - parent::init_admin();
23 - }
24 - public function init_frontend() {
25 - parent::init_frontend();
26 - // add tasks or filters here that you want to perform only in the front end
27 - }
28 - function type( $position, $form_id ) {
29 - if ( $position == 1550 ) {
30 - ?>
31 - <li class="field_field_repeater_title_setting field_setting">
32 - <label class="section_label">
33 - <?php esc_html_e('Title', 'repeater-for-gravity-forms'); ?>
34 - </label>
35 - <input type="text" id="repeater_title" placeholder="Person" value="" onchange="SetFieldProperty('repeater_title', this.value);">
36 - <?php esc_html_e("An optional title before each row of the repeater",'repeater-for-gravity-forms') ?>
37 - </li>
38 - <?php do_action( "yeeaddons_gf_repeater_settings") ?>
39 - <li class="field_field_repeater_end_text_setting field_setting">
40 - <label class="section_label">
41 - <?php esc_html_e('Text button', 'repeater-for-gravity-forms'); ?>
42 - </label>
43 - <input type="text" id="field_repeater_end_text" placeholder="Add more" value="" onchange="SetFieldProperty('field_repeater_end_text', this.value);">
44 - <?php esc_html_e("add button text",'repeater-for-gravity-forms') ?>
45 - </li>
46 - <?php
47 - }
48 - }
49 - function editor_script(){
50 - ?>
51 - <script type='text/javascript'>
52 - ( function( $ ) {
53 - "use strict";
54 - jQuery(document).ready(function($) {
55 - jQuery(document).on('gform_load_field_settings', function(event, field, form){
56 - jQuery('#repeater_title').val( field.repeater_title);
57 - jQuery('#repeater_initial_rows').val( field.repeater_initial_rows);
58 - jQuery('#repeater_max').val( field.repeater_max);
59 - jQuery('#repeater_initial_rows_map').val( field.repeater_initial_rows_map);
60 - jQuery('#field_repeater_end_text').val( field.field_repeater_end_text);
61 - });
62 - });
63 - } )( jQuery );
64 - </script>
65 - <?php
66 - }
67 - public function pre_init() {
68 - parent::pre_init();
69 - add_filter( "gform_input_mask_script",array($this,"gform_input_mask_script"),10,4 );
70 - add_action( 'gform_field_standard_settings', array($this,'type'), 10, 2 );
71 - add_action( 'gform_editor_js', array($this,'editor_script') );
72 - include SUPERADDONS_GF_REPEATER_PLUGIN_PATH."fields/repeater_field.php";
73 - include SUPERADDONS_GF_REPEATER_PLUGIN_PATH."fields/repeater_start_field.php";
74 - add_filter( 'gform_pre_validation', array( "Superaddons_GFRepeater_Field", 'remove_validation' ) );
75 - add_filter( 'gform_admin_pre_render', array( 'Superaddons_GFRepeater_Field', 'remove_child_fields' ) );
76 - add_filter( 'gform_form_post_get_meta', array( 'Superaddons_GFRepeater_Field', 'remove_child_fields' ) );
77 - add_action( 'gform_enqueue_scripts', array($this,"add_data"),10,2 );
78 - }
79 - function gform_input_mask_script($script_str,$form_id,$field_id,$mask){
80 - $input_mask = get_option( "yeeaddons_gf_input_mask",array());
81 - $input_mask["input_".$form_id."_".$field_id] = esc_js( $mask );
82 - update_option( "yeeaddons_gf_input_mask",$input_mask );
83 - return $script_str;
84 - }
85 - function add_data($form, $is_ajax ){
86 - $input_mask = get_option( "yeeaddons_gf_input_mask",array());
87 - wp_enqueue_script( 'gf_repeater', SUPERADDONS_GF_REPEATER_PLUGIN_URL."libs/wp_repeater.js", array('jquery',"gform_masked_input"),time());
88 - $check_pro = get_option( '_redmuber_item_1540');
89 - wp_localize_script("gf_repeater","yeeaddons_gf_repeater_data",array("input_mask"=>($input_mask),"pro"=>$check_pro));
90 - }
91 - public function styles() {
92 - $styles = array(
93 - array(
94 - 'handle' => 'repeater_icon',
95 - 'src' => SUPERADDONS_GF_REPEATER_PLUGIN_URL."libs/css/repeatericons.css",
96 - 'version' => time(),
97 - 'enqueue' => array(
98 - array( 'field_types' => array( 'repeater_end' ) )
99 - )
100 - ),
101 - array(
102 - 'handle' => 'gf_repeater',
103 - 'src' => SUPERADDONS_GF_REPEATER_PLUGIN_URL."libs/wp_repeater.css",
104 - 'version' => time(),
105 - 'enqueue' => array(
106 - array( 'field_types' => array( 'repeater_end' ) )
107 - )
108 - ),
109 - );
110 - return array_merge( parent::styles(), $styles );
111 - }
112 -}