• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mc4wp_get_form函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中mc4wp_get_form函数的典型用法代码示例。如果您正苦于以下问题:PHP mc4wp_get_form函数的具体用法?PHP mc4wp_get_form怎么用?PHP mc4wp_get_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mc4wp_get_form函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: output_form

 /**
  * @param int   $id
  * @param array $config
  * @param bool $echo
  *
  * @return string
  */
 public function output_form($id = 0, $config = array(), $echo = true)
 {
     try {
         $form = mc4wp_get_form($id);
     } catch (Exception $e) {
         if (current_user_can('manage_options')) {
             return sprintf('<strong>MailChimp for WordPress error:</strong> %s', $e->getMessage());
         }
         return '';
     }
     $this->count++;
     if (empty($config['element_id'])) {
         $config['element_id'] = 'mc4wp-form-' . $this->count;
     }
     $this->printed_forms[$form->ID] = $form;
     $this->printed_field_types += $form->get_field_types();
     $this->printed_field_types = array_unique($this->printed_field_types);
     $html = $form->get_html($config['element_id'], $config);
     /**
      * Runs just before a form element is outputted.
      *
      * @since 3.0
      *
      * @param MC4WP_Form $form
      */
     do_action('mc4wp_output_form', $form);
     if ($echo) {
         echo $html;
     }
     return $html;
 }
开发者ID:petersuhm,项目名称:mailchimp-for-wordpress,代码行数:38,代码来源:class-output-manager.php


示例2: listen

 /**
  * Listen for submitted forms
  *
  * @param $data
  * @return bool
  */
 public function listen(array $data)
 {
     if (!isset($data['_mc4wp_form_id'])) {
         return false;
     }
     /**
      * @var MC4WP_Request $request
      */
     $request = mc4wp('request');
     try {
         $form = mc4wp_get_form($request->params->get('_mc4wp_form_id'));
     } catch (Exception $e) {
         return false;
     }
     // where the magic happens
     $form->handle_request($request);
     $form->validate();
     // store submitted form
     $this->submitted_form = $form;
     // did form have errors?
     if (!$form->has_errors()) {
         // form was valid, do something
         $method = 'process_' . $form->get_action() . '_form';
         call_user_func(array($this, $method), $form);
     }
     $this->respond($form);
     return true;
 }
开发者ID:petersuhm,项目名称:mailchimp-for-wordpress,代码行数:34,代码来源:class-form-listener.php


示例3: listen

 /**
  * Listen for submitted forms
  *
  * @param MC4WP_Request $request
  * @return bool
  */
 public function listen(MC4WP_Request $request)
 {
     if (!$request->post->get('_mc4wp_form_id')) {
         return false;
     }
     try {
         $form = mc4wp_get_form($request->params->get('_mc4wp_form_id'));
     } catch (Exception $e) {
         return false;
     }
     // where the magic happens
     $form->handle_request($request);
     $form->validate();
     // store submitted form
     $this->submitted_form = $form;
     // did form have errors?
     if (!$form->has_errors()) {
         // form was valid, do something
         $method = 'process_' . $form->get_action() . '_form';
         call_user_func(array($this, $method), $form);
     } else {
         $this->get_log()->info(sprintf("Form %d > Submitted with errors: %s", $form->ID, join(', ', $form->errors)));
     }
     $this->respond($form);
     return true;
 }
开发者ID:aaronfrey,项目名称:PepperLillie-TAT,代码行数:32,代码来源:class-form-listener.php


示例4: __construct

 /**
  * @param int $form_id
  * @param int $preview_id
  *
  * @throws Exception
  */
 public function __construct($form_id, $preview_id = 0)
 {
     $this->form_id = $form_id;
     $this->preview_id = $preview_id;
     $this->is_preview = $preview_id > 0;
     if (!$this->is_preview) {
         $this->preview_id = $form_id;
     }
     $this->form = mc4wp_get_form($this->preview_id);
 }
开发者ID:spielhoelle,项目名称:amnesty,代码行数:16,代码来源:class-form-previewer.php


示例5: widget

 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array   $args     Widget arguments.
  * @param array   $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     $title = apply_filters('widget_title', $instance['title']);
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // make sure template functions exist (for usage in avia layout builder)
     if (!function_exists('mc4wp_get_form')) {
         include_once MC4WP_LITE_PLUGIN_DIR . 'includes/functions/template.php';
     }
     echo mc4wp_get_form(0);
     echo $args['after_widget'];
 }
开发者ID:sydneyDAD,项目名称:cardguys.com,代码行数:22,代码来源:class-widget.php


示例6: widget

 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array   $args     Widget arguments.
  * @param array   $options Saved values from database.
  */
 public function widget($args, $options)
 {
     $options = array_merge($this->default_options, $options);
     $options['title'] = apply_filters('widget_title', $options['title']);
     if (empty($options['form_id'])) {
         $options['form_id'] = get_option('mc4wp_default_form_id', 0);
     }
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $options['title'] . $args['after_title'];
     }
     echo mc4wp_get_form($options['form_id']);
     echo $args['after_widget'];
 }
开发者ID:hchouhan,项目名称:mailchimp-for-wordpress,代码行数:22,代码来源:Widget.php


示例7: __construct

 /**
  * @param int $form_id
  * @param bool $is_preview
  */
 public function __construct($form_id, $is_preview = false)
 {
     $this->form_id = $form_id;
     $this->is_preview = $is_preview;
     // get the preview form
     if ($is_preview) {
         $this->preview_form_id = $this->get_preview_id();
     }
     // if that failed, get the real form
     if (empty($this->preview_form_id)) {
         $this->preview_form_id = $this->form_id;
     }
     // get form instance
     $this->form = mc4wp_get_form($this->preview_form_id);
 }
开发者ID:nihrain,项目名称:accelerate,代码行数:19,代码来源:class-form-previewer.php


示例8: widget

 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array   $args     Widget arguments.
  * @param array   $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     $title = apply_filters('widget_title', $instance['title']);
     $form_id = isset($instance['form_id']) ? $instance['form_id'] : get_option('mc4wp_default_form_id', 0);
     if (empty($form_id)) {
         if (current_user_can('manage_options')) {
             $form = 'Please select the sign-up form you\'d like to show here in the <a href="' . admin_url('widgets.php') . '">widget settings</a>.';
         } else {
             $form = '';
         }
     } else {
         $form = mc4wp_get_form($form_id);
     }
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     echo $form;
     echo $args['after_widget'];
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:28,代码来源:class-widget.php


示例9: widget

 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array   $args     Widget arguments.
  * @param array   $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     $title = isset($instance['title']) ? $instance['title'] : '';
     $title = apply_filters('widget_title', $title);
     // which form should we show?
     $form_id = isset($instance['form_id']) && !empty($instance['form_id']) ? $instance['form_id'] : get_option('mc4wp_default_form_id', false);
     if (false === $form_id) {
         if (current_user_can('manage_options')) {
             $form = sprintf(__('Please select the sign-up form you\'d like to show here in the <a href="%s">widget settings</a>.', 'mailchimp-for-wp'), admin_url('widgets.php'));
         } else {
             $form = '';
         }
     } else {
         $form = mc4wp_get_form($form_id);
     }
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     echo $form;
     echo $args['after_widget'];
 }
开发者ID:Ore4444,项目名称:old.backfeed.cc,代码行数:30,代码来源:class-widget.php


示例10: output_form

 /**
  * @param int   $id
  * @param array $config
  * @param bool $echo
  *
  * @return string
  */
 public function output_form($id = 0, $config = array(), $echo = true)
 {
     try {
         $form = mc4wp_get_form($id);
     } catch (Exception $e) {
         if (current_user_can('manage_options')) {
             return sprintf('<strong>MailChimp for WordPress error:</strong> %s', $e->getMessage());
         }
         return '';
     }
     $this->count++;
     // set a default element_id if none is given
     if (empty($config['element_id'])) {
         $config['element_id'] = 'mc4wp-form-' . $this->count;
     }
     $this->printed_forms[$form->ID] = $form;
     $this->printed_field_types += $form->get_field_types();
     $this->printed_field_types = array_unique($this->printed_field_types);
     // start new output buffer
     ob_start();
     /**
      * Runs just before a form element is outputted.
      *
      * @since 3.0
      *
      * @param MC4WP_Form $form
      */
     do_action('mc4wp_output_form', $form);
     // output the form (in output buffer)
     echo $form->get_html($config['element_id'], $config);
     // grab all contents in current output buffer & then clean it.
     $html = ob_get_clean();
     // echo content if necessary
     if ($echo) {
         echo $html;
     }
     return $html;
 }
开发者ID:dannyvankooten,项目名称:mailchimp-for-wordpress,代码行数:45,代码来源:class-output-manager.php


示例11: listen

 /**
  * Listen for submitted forms
  *
  * @param $data
  * @return bool
  */
 public function listen(array $data)
 {
     if (!isset($data['_mc4wp_form_id'])) {
         return false;
     }
     $request = mc4wp('request');
     try {
         $form = mc4wp_get_form($request->params->get('_mc4wp_form_id'));
     } catch (Exception $e) {
         return false;
     }
     // where the magic happens
     $form->handle_request($request);
     $this->submitted_form = $form;
     // is this form valid?
     if ($form->is_valid()) {
         // form was valid, do something
         $method = 'process_' . $form->get_action() . '_form';
         call_user_func(array($this, $method), $form);
     }
     $this->respond($form);
     return true;
 }
开发者ID:novichkovv,项目名称:prlab,代码行数:29,代码来源:class-form-listener.php


示例12: show_page

 /**
  * Show Styles Builder page
  */
 function show_page()
 {
     $forms = mc4wp_get_forms();
     $form_id = $forms[0]->ID;
     // get form to which styles should apply
     if (isset($_GET['form_id'])) {
         $form_id = absint($_GET['form_id']);
     }
     $form = mc4wp_get_form($form_id);
     // get css settings for this form (or 0)
     $builder = new MC4WP_Styles_Builder();
     $styles = $builder->get_form_styles($form_id);
     // create preview url
     $preview_url = add_query_arg(array('form_id' => $form_id, '_mc4wp_styles_builder_preview' => 1), home_url());
     require dirname(__FILE__) . '/../views/styles-builder.php';
 }
开发者ID:siggisdairy,项目名称:siggis-web,代码行数:19,代码来源:class-admin.php


示例13: show_edit_page

 /**
  * Show the "Edit Form" page
  *
  * @internal
  */
 public function show_edit_page()
 {
     $form_id = !empty($_GET['form_id']) ? (int) $_GET['form_id'] : 0;
     $lists = $this->mailchimp->get_lists();
     try {
         $form = mc4wp_get_form($form_id);
     } catch (Exception $e) {
         echo '<h2>' . __("Form not found.", 'mailchimp-for-wp') . '</h2>';
         echo '<p>' . $e->getMessage() . '</p>';
         echo '<p><a href="javascript:history.go(-1);"> &lsaquo; ' . __('Go back') . '</a></p>';
         return;
     }
     $opts = $form->settings;
     $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'fields';
     require dirname(__FILE__) . '/views/edit-form.php';
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:21,代码来源:class-admin.php


示例14: mc4wp_form_get_response_html

/**
 * @since 2.3.8
 * @deprecated 3.0
 * @ignore
 * @use mc4wp_get_form
 *
 * @param int $form_id (optional)
 *
 * @return string
 */
function mc4wp_form_get_response_html($form_id = 0)
{
    try {
        $form = mc4wp_get_form($form_id);
    } catch (Exception $e) {
        return '';
    }
    return $form->get_response_html();
}
开发者ID:nihrain,项目名称:accelerate,代码行数:19,代码来源:functions.php


示例15: column_type

 /**
  * Outputs the text for the "type" column
  *
  * @param $item
  *
  * @return string|void
  */
 public function column_type($item)
 {
     if (isset($this->integrations[$item->type])) {
         $object_link = $this->integrations[$item->type]->get_object_link($item->related_object_ID);
         if (!empty($object_link)) {
             return $object_link;
         }
         return $this->integrations[$item->type]->name;
     }
     if ($item->type === 'mc4wp-form') {
         $form_id = $item->related_object_ID;
         try {
             $form = mc4wp_get_form($form_id);
             return '<a href="' . mc4wp_get_edit_form_url($form->ID) . '">' . $form->name . '</a>';
         } catch (Exception $e) {
             return __('Form', 'mailchimp-for-wp') . ' ' . $form_id . ' <em>(' . __('deleted', 'mailchimp-for-wp') . ')</em>';
         }
     } elseif ($item->type === 'mc4wp-top-bar') {
         return 'MailChimp Top Bar';
     }
     return $item->type;
 }
开发者ID:siggisdairy,项目名称:siggis-web,代码行数:29,代码来源:class-log-table.php


示例16: mc4wp_form

/**
* Echoes sign-up form with given $form_id.
* @param int $form_id.
*/
function mc4wp_form($id = 0)
{
    echo mc4wp_get_form($id);
}
开发者ID:sydneyDAD,项目名称:cardguys.com,代码行数:8,代码来源:template.php


示例17: build_stylesheet

 /**
  * Build file with given CSS values
  *
  * @param int $form_id
  * @return bool
  */
 protected function build_stylesheet($form_id)
 {
     $css_string = $this->get_css_string($form_id);
     $filename = sprintf(self::DIR . 'form-%d.css', $form_id);
     // upload CSS file with CSS string as content
     $upload = wp_upload_dir();
     $target = $upload['basedir'];
     // try to create stylesheets dir with proper permissions
     @mkdir($target . rtrim(self::DIR, '/'), 0755);
     @chmod($target . rtrim(self::DIR, '/'), 0755);
     // remove previous file
     @unlink($target . $filename);
     // create new file
     $success = file_put_contents($target . $filename, $css_string);
     @chmod($target . $filename, 0755);
     if (!$success) {
         $message = __('Error creating stylesheet.', 'mailchimp-for-wp') . '</strong><br />';
         $message .= sprintf(__('Please add the generated CSS to your theme stylesheet manually or use a plugin like <em>%s</em>.', 'mailchimp-for-wp'), '<a href="https://wordpress.org/plugins/simple-custom-css/">Simple Custom CSS</a>') . '<br />';
         $message .= '<a class="mc4wp-show-css button" href="javascript:void(0);">' . __('Show generated CSS', 'mailchimp-for-wp') . '</a>';
         $message .= '<textarea id="mc4wp_generated_css" readonly style="display:none; width: 100%; min-height: 300px; margin-top: 20px;">' . esc_html($css_string) . '</textarea><strong>';
         add_settings_error('mc4wp', 'mc4wp-css', $message);
         return;
     }
     // create url
     $url = $upload['baseurl'] . $filename;
     $message = sprintf(__('The <a href="%s">CSS Stylesheet</a> was successfully created.', 'mailchimp-for-wp'), $url);
     // check if stylesheet is being loaded for this form, otherwise show notice.
     $form = mc4wp_get_form($form_id);
     if ($form->settings['css'] !== 'styles-builder') {
         $message .= '</strong><br /><br />' . sprintf(__('Please note that you need to <a href="%s">select "Use Styles Builder" in the form appearance settings</a> if you want to use these styles.', 'mailchimp-for-wp'), mc4wp_get_edit_form_url($form_id, 'appearance')) . '<strong>';
     }
     // show notice
     add_settings_error('mc4wp', 'mc4wp-css', $message, 'updated');
     return true;
 }
开发者ID:siggisdairy,项目名称:siggis-web,代码行数:41,代码来源:class-styles-builder.php


示例18: mc4wp_form

 /**
  * Echoes sign-up form with given $form_id.
  *
  * @param array $atts
  */
 function mc4wp_form($atts = array())
 {
     echo mc4wp_get_form($atts);
 }
开发者ID:hchouhan,项目名称:mailchimp-for-wordpress,代码行数:9,代码来源:functions.php


示例19: mc4wp_show_form

/**
 * Echoes a sign-up form.
 *
 * @param   int     form ID
 *
 * @deprecated 1.3.1 Use mc4wp_form() instead.
 * @see mc4wp_form()
 */
function mc4wp_show_form($form_id)
{
    _deprecated_function(__FUNCTION__, 'MailChimp for WP Pro v1.3.1', 'mc4wp_form');
    echo mc4wp_get_form($form_id);
}
开发者ID:Infernosaint,项目名称:WPSetupTest2,代码行数:13,代码来源:template.php


示例20: mc4wp_show_form

/**
 * Echoes a sign-up form.
 *
 * @deprecated 1.3.1 Use mc4wp_form() instead.
 * @see mc4wp_form()
 */
function mc4wp_show_form($form_id)
{
    echo mc4wp_get_form($form_id);
}
开发者ID:donwea,项目名称:nhap.org,代码行数:10,代码来源:template-functions.php



注:本文中的mc4wp_get_form函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mc_credit_fetch函数代码示例发布时间:2022-05-15
下一篇:
PHP mc4wp函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap