本文整理汇总了PHP中RGForms::get_form方法的典型用法代码示例。如果您正苦于以下问题:PHP RGForms::get_form方法的具体用法?PHP RGForms::get_form怎么用?PHP RGForms::get_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGForms
的用法示例。
在下文中一共展示了RGForms::get_form方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
function content($block)
{
$form_id = parent::get_setting($block, 'form-id', null);
//If no form ID is present, display the message and stop this function.
if (!$form_id) {
echo '<p>There is no form to display.</p>';
return;
}
$display_title = parent::get_setting($block, 'display-title', true);
$display_description = parent::get_setting($block, 'display-description', true);
$force_display = true;
$field_values = null;
$use_ajax = parent::get_setting($block, 'use-ajax', false);
echo RGForms::get_form($form_id, $display_title, $display_description, $force_display, null, $use_ajax);
}
示例2: 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;
}
$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;
}
示例3: 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;
}
$form = RGForms::get_form($instance['form'], $instance['showtitle'], $instance['showdesc']);
// Fix the tab indices
preg_match_all("/tabindex='([0-9]+)'/", $form, $matches, PREG_SET_ORDER);
$diff = $instance['tabindex'] - $matches[0][1];
foreach ($matches as $match) {
$newtabindex = str_replace($match[1], $match[1] + $diff, $match[0]);
$form = str_replace($match[0], $newtabindex, $form);
}
// Output the form
echo $form;
echo $after_widget;
}
示例4: 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;
}
示例5: gravity_form
function gravity_form($id, $display_title = true, $display_description = true, $display_inactive = false, $field_values = null, $ajax = false, $tabindex = 1, $echo = true)
{
if (!$echo) {
return RGForms::get_form($id, $display_title, $display_description, $display_inactive, $field_values, $ajax, $tabindex);
}
echo RGForms::get_form($id, $display_title, $display_description, $display_inactive, $field_values, $ajax, $tabindex);
}
示例6: gravity_form
function gravity_form($id, $display_title = true, $display_description = true, $display_inactive = false, $field_values = null, $ajax = false)
{
echo RGForms::get_form($id, $display_title, $display_description, $display_inactive, $field_values, $ajax);
}
示例7: get_form
function get_form($options)
{
global $woocommerce;
$product = null;
if (function_exists('get_product')) {
$product = get_product($this->product_id);
} else {
$product = new WC_Product($this->product_id);
}
extract(shortcode_atts(array('display_title' => true, 'display_description' => true, 'display_inactive' => false, 'field_values' => false, 'ajax' => false, 'tabindex' => 1, 'label_subtotal' => __('Subtotal', 'wc_gf_addons'), 'label_options' => __('Options', 'wc_gf_addons'), 'label_total' => __('Total', 'wc_gf_addons'), 'disable_label_subtotal' => 'no', 'disable_label_options' => 'no', 'disable_label_total' => 'no', 'disable_calculations' => 'no'), $options));
//Get the form meta so we can make sure the form exists.
$form_meta = RGFormsModel::get_form_meta($this->form_id);
if (!empty($form_meta)) {
if (!empty($_POST)) {
$_POST['gform_submit'] = isset($_POST['gform_old_submit']) ? $_POST['gform_old_submit'] : '';
$_POST['gform_old_submit'] = $_POST['gform_submit'];
}
$form = RGForms::get_form($this->form_id, $display_title, $display_description, $display_inactive, $field_values, $ajax, $tabindex);
unset($_POST['gform_submit']);
$form = str_replace('</form>', '', $form);
$form = str_replace('gform_submit', 'gform_old_submit', $form);
$this->current_page = GFFormDisplay::get_current_page($this->form_id);
$this->next_page = $this->current_page + 1;
$this->previous_page = $this->current_page - 1;
$this->next_page = $this->next_page > $this->get_max_page_number($form_meta) ? 0 : $this->next_page;
if ($product->product_type == 'variable' || $product->product_type == 'variable-subscription') {
echo '<div class="gform_variation_wrapper gform_wrapper single_variation_wrap">';
} else {
echo '<div class="gform_variation_wrapper gform_wrapper">';
}
if ($product->is_type('variable')) {
//echo '<input type="hidden" name="add-to-cart" value="variation" />';
echo '<input type="hidden" id="product_id" name="product_id" value="' . $this->product_id . '" />';
} elseif ($product->has_child()) {
//echo '<input type="hidden" name="add-to-cart" value="group" />';
echo '<input type="hidden" id="product_id" name="product_id" value="' . $this->product_id . '" />';
} else {
//echo '<input type="hidden" name="add-to-cart" value="' . $this->product_id . '" />';
echo '<input type="hidden" id="product_id" name="product_id" value="' . $this->product_id . '" />';
}
if (wc_is_21x()) {
wp_nonce_field('add_to_cart');
} else {
$woocommerce->nonce_field('add_to_cart');
}
echo '<a id="_form_' . $this->form_id . '" href="#_form_' . $this->form_id . '" class="gform_anchor"></a>';
echo $form;
echo '<input type="hidden" name="gform_form_id" id="gform_form_id" value="' . $this->form_id . '" />';
echo '<input type="hidden" id="woocommerce_get_action" value="" />';
echo '<input type="hidden" id="woocommerce_product_base_price" value="' . $product->get_price() . '" />';
$description_class = rgar($form_meta, "descriptionPlacement") == "above" ? "description_above" : "description_below";
?>
<?php
$this->on_print_scripts();
if ($disable_calculations == 'no') {
?>
<div class="product_totals">
<ul id="gform_totals_<?php
echo $this->form_id;
?>
" class="gform_fields <?php
echo $form_meta['labelPlacement'] . ' ' . $description_class;
?>
">
<li class="gfield" <?php
if ($disable_label_subtotal == 'yes') {
echo 'style="display:none;"';
}
?>
>
<label class="gfield_label"><?php
echo $label_subtotal;
?>
</label>
<div class="ginput_container">
<span class="formattedBasePrice ginput_total"></span>
</div>
</li>
<li class="gfield" <?php
if ($disable_label_options == 'yes') {
echo 'style="display:none;"';
}
?>
>
<label class="gfield_label"><?php
echo $label_options;
?>
</label>
<div class="ginput_container">
<span class="formattedVariationTotal ginput_total"></span>
</div>
</li>
<li class="gfield" <?php
if ($disable_label_total == 'yes') {
echo 'style="display:none;"';
}
?>
>
//.........这里部分代码省略.........
示例8: mab_gforms_the_content
/**
* Display the output of the Gforms action box
*/
function mab_gforms_the_content($content, $action_box_obj)
{
$type = $action_box_obj->getActionBoxType();
//process only our action box type
if (MAB_GFORMS_TYPE != $type) {
return $content;
}
$meta = $action_box_obj->getMeta();
$meta = $meta['gforms'];
/* TODO: add option for tab index **/
$tab_index = 1;
$form_id = !empty($meta['form-id']) ? $meta['form-id'] : 0;
$show_title = !empty($meta['show-title']) ? true : false;
$show_desc = !empty($meta['show-desc']) ? true : false;
$do_ajax = !empty($meta['ajax']) ? true : false;
//credits: from gforms code
$field_values = !empty($meta['field-values']) ? htmlspecialchars_decode($meta['field-values']) : '';
$field_values = str_replace("&", "&", $field_values);
parse_str($field_values, $field_value_array);
//parsing query string like string for field values and placing them into an associative array
$field_value_array = stripslashes_deep($field_value_array);
//if( empty( $form_id ) ) return '';
$form = RGForms::get_form($form_id, $show_title, $show_desc, false, $field_value_array, $do_ajax, $tab_index);
return $form;
}
示例9: wp_print_scripts
wp_print_scripts();
$styles = apply_filters("gform_preview_styles", false, $form);
if (!empty($styles)) {
wp_print_styles($styles);
}
?>
</head>
<body>
<div id="preview_top">
<div id="preview_hdr">
<div><span class="actionlinks"><a href="javascript:window.close()" class="close_window"><?php
_e("close window", "gravityforms");
?>
</a></span><?php
_e("Form Preview", "gravityforms");
?>
</div>
</div>
<div id="preview_note"><?php
_e("Note: This is a simple form preview. This form may display differently when added to your page based on inheritance from individual theme styles.", "gravityforms");
?>
</div>
</div>
<div id="preview_form_container">
<?php
echo RGForms::get_form($_GET["id"], true, true, true);
?>
</div>
</body>
</html>
示例10: esc_html_e
<div id="preview_hdr">
<div>
<span class="actionlinks"><a href="javascript:window.close()" class="close_window"><?php
esc_html_e('close window', 'gravityforms');
?>
</a></span><h2><?php
esc_html_e('Form Preview', 'gravityforms');
?>
</h2>
</div>
</div>
<div id="preview_note"><?php
esc_html_e('Note: This is a simple form preview. This form may display differently when added to your page based on inheritance from individual theme styles.', 'gravityforms');
?>
</div>
</div>
<div id="preview_form_container">
<?php
echo RGForms::get_form($_GET['id'], true, true, true);
?>
</div>
<?php
/**
* Fires in the footer of a Form Preview page
*
* @param int $_GET['id'] The ID of the form currently being previewed
*/
do_action('gform_preview_footer', $_GET['id']);
?>
</body>
</html>
示例11: build_poll_ui
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;
}
}
示例12: esc_html_e
?>
<i class="hidenotice" title="<?php
esc_html_e('dismiss', 'gravityforms');
?>
"></i>
</div>
</div>
<div id="helper_legend_container">
<ul id="helper_legend">
<li class="showid">Element ID</li>
<li class="showclass">Class Name</li>
</ul>
</div>
<div id="preview_form_container">
<?php
echo RGForms::get_form($form_id, true, true, true);
?>
</div>
<div id="browser_size_info"></div>
<!-- load up the styles -->
<link rel='stylesheet' href='<?php
echo GFCommon::get_base_url();
?>
/css/reset<?php
echo $min;
?>
.css' type='text/css' />
<?php
wp_print_footer_scripts();