当前位置: 首页>>代码示例>>PHP>>正文


PHP GVCommon::send_email方法代码示例

本文整理汇总了PHP中GVCommon::send_email方法的典型用法代码示例。如果您正苦于以下问题:PHP GVCommon::send_email方法的具体用法?PHP GVCommon::send_email怎么用?PHP GVCommon::send_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GVCommon的用法示例。


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

示例1: maybe_send_entry_notes

 /**
  * If note has an email to send, and the user has the right caps, send it
  *
  * @since 1.17
  *
  * @param false|object $note If note was created, object. Otherwise, false.
  * @param array $entry Entry data
  * @param array $data $_POST data
  *
  * @return void Tap in to Gravity Forms' `gform_after_email` action if you want a return result from sending the email.
  */
 private function maybe_send_entry_notes($note = false, $entry, $data)
 {
     if (!$note || !GVCommon::has_cap('gravityview_email_entry_notes')) {
         do_action('gravityview_log_debug', __METHOD__ . ': User doesnt have "gravityview_email_entry_notes" cap, or $note is empty', $note);
         return;
     }
     do_action('gravityview_log_debug', __METHOD__ . ': $data', $data);
     //emailing notes if configured
     if (!empty($data['gv-note-to'])) {
         $default_data = array('gv-note-to' => '', 'gv-note-to-custom' => '', 'gv-note-subject' => '', 'gv-note-content' => '');
         $current_user = wp_get_current_user();
         $email_data = wp_parse_args($data, $default_data);
         $from = $current_user->user_email;
         $to = $email_data['gv-note-to'];
         /**
          * Documented in get_note_email_fields
          * @see get_note_email_fields
          */
         $include_custom = apply_filters('gravityview/field/notes/custom-email', true);
         if ('custom' === $to && $include_custom) {
             $to = $email_data['gv-note-to-custom'];
             do_action('gravityview_log_debug', __METHOD__ . ': Sending note to a custom email address: ' . $to);
         }
         if (!is_email($to)) {
             do_action('gravityview_log_error', __METHOD__ . ': $to not a valid email address: ' . $to, $email_data);
             return;
         }
         $bcc = false;
         $reply_to = $from;
         $subject = trim($email_data['gv-note-subject']);
         // We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF
         $subject = empty($subject) ? self::strings('default-email-subject') : $subject;
         $message = $email_data['gv-note-content'];
         $from_name = $current_user->display_name;
         $message_format = 'html';
         /**
          * @filter `gravityview/field/notes/email_content` Modify the values passed when sending a note email
          * @see GVCommon::send_email
          * @since 1.17
          * @param[in,out] array $email_settings Values being passed to the GVCommon::send_email() method: 'from', 'to', 'bcc', 'reply_to', 'subject', 'message', 'from_name', 'message_format', 'entry'
          */
         $email_content = apply_filters('gravityview/field/notes/email_content', compact('from', 'to', 'bcc', 'reply_to', 'subject', 'message', 'from_name', 'message_format', 'entry'));
         extract($email_content);
         GVCommon::send_email($from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false);
         $form = isset($entry['form_id']) ? GFAPI::get_form($entry['form_id']) : array();
         /**
          * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms
          */
         do_action('gform_post_send_entry_note', __METHOD__, $to, $from, $subject, $message, $form, $entry);
     }
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:62,代码来源:class-gravityview-field-notes.php


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