function widget($args, $instance) { extract($args); echo $before_widget; $title = apply_filters('widget_title', $instance['title']); if ($title) { echo $before_title . $title . $after_title; } $tabindex = is_numeric($instance['tabindex']) ? $instance['tabindex'] : 1; //creating form $form = RGFormsModel::get_form_meta($instance['form_id']); if (empty($instance['disable_scripts']) && !is_admin()) { RGForms::print_form_scripts($form, $instance['ajax']); } $form_markup = RGForms::get_form($instance['form_id'], $instance['showtitle'], $instance['showdescription'], false, null, $instance['ajax'], $tabindex); //display form echo $form_markup; echo $after_widget; }
function widget($args, $instance) { extract($args); echo $before_widget; $title = apply_filters('widget_title', $instance['title']); if ($title) { echo $before_title . $title . $after_title; } //setting tabindex based on configured value if (is_numeric($instance['tabindex'])) { add_filter("gform_tabindex_{$instance['form_id']}", create_function("", "return {$instance['tabindex']};")); } //creating form $form = RGFormsModel::get_form_meta($instance['form_id']); if (empty($instance["disable_scripts"]) && !is_admin()) { RGForms::print_form_scripts($form, $instance["ajax"]); } $form_markup = RGForms::get_form($instance['form_id'], $instance['showtitle'], $instance['showdescription'], false, null, $instance["ajax"]); //display form echo $form_markup; echo $after_widget; }
public function build_poll_ui($form_id, $field_id = 0, $style = 'green', $mode = 'poll', $percentages = true, $counts = true, $title = true, $description = true, $confirmation = false, $show_results_link, $ajax = false, $cookie = '', $display_results = true, $field_values = '', $disable_scripts = false, $tabindex, $return = true) { $form = RGFormsModel::get_form_meta($form_id); if (empty($form)) { return; } $poll_fields = GFAPI::get_fields_by_type($form, array('poll')); if (empty($poll_fields)) { return; } $this->gpoll_add_scripts = true; if ($mode == 'results') { $results = $this->gpoll_get_results($form_id, $field_id, $style, $percentages, $counts); $output = $results['summary']; } else { $checksum = $this->generate_checksum($display_results, $show_results_link, $cookie, $confirmation, $percentages, $counts, $style); $show_results_link = false === $show_results_link ? 0 : 1; $field_values = htmlspecialchars_decode($field_values); $field_values = str_replace('&', '&', $field_values); $percentages = $percentages === false ? 0 : 1; $counts = $counts === false ? 0 : 1; $display_results = $display_results ? 1 : 0; if ($disable_scripts === false) { RGForms::print_form_scripts($form, $ajax); } if ($field_values != '') { $field_values .= '&'; } $field_values .= "gpoll_enabled=1&gpoll_field={$field_id}&gpoll_style={$style}&gpoll_display_results={$display_results}&gpoll_show_results_link={$show_results_link}&gpoll_cookie={$cookie}&gpoll_confirmation={$confirmation}&gpoll_percentages={$percentages}&gpoll_counts={$counts}&gpoll_checksum={$checksum}"; parse_str($field_values, $field_value_array); $field_value_array = stripslashes_deep($field_value_array); $output = RGForms::get_form($form_id, $title, $description, false, $field_value_array, $ajax, $tabindex); } if (false === $return) { echo $output; } else { return $output; } }