Ignore:
Timestamp:
Nov 18, 2013, 6:36:35 PM (10 years ago)
Author:
mistic100
Message:

feature 2999: Documentation of include/functions_mail|metadata|picture

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_mail.inc.php

    r25384 r25550  
    2323
    2424/**
     25 * @package functions\mail
     26 */
     27
     28
     29/**
    2530 * Returns the name of the mail sender
     31 *
    2632 * @return string
    2733 */
     
    3541/**
    3642 * Returns the email of the mail sender
     43 *
    3744 * @since 2.6
    3845 * @return string
     
    4653
    4754/**
    48  * Returns an array of mail configuration parameters :
     55 * Returns an array of mail configuration parameters.
    4956 * - send_bcc_mail_webmaster
    5057 * - mail_allow_html
     
    8087
    8188/**
    82  * Returns an email address with an associated real name
    83  * @param string name
    84  * @param string email
     89 * Returns an email address with an associated real name.
     90 * Can return either:
     91 *    - email@domain.com
     92 *    - name <email@domain.com>
     93 *
     94 * @param string $name
     95 * @param string $email
     96 * @return string
    8597 */
    8698function format_email($name, $email)
     
    105117
    106118/**
    107  * Returns the mail and the name from a formatted address
     119 * Returns the email and the name from a formatted address.
    108120 * @since 2.6
    109  * @param string|array $input
    110  * @return array
     121 *
     122 * @param string|string[] $input - if is an array must contain email[, name]
     123 * @return array email, name
    111124 */
    112125function unformat_email($input)
     
    138151
    139152/**
    140  * Return a clean array of hashmaps (email, name) from various inputs
    141  * - comma separated list
    142  * - array of emails
    143  * - single hashmap (email[, name])
     153 * Return a clean array of hashmaps (email, name) removing duplicates.
     154 * It accepts various inputs:
     155 *    - comma separated list
     156 *    - array of emails
     157 *    - single hashmap (email[, name])
     158 *    - array of incomplete hashmaps
    144159 * @since 2.6
    145160 *
     
    164179        {
    165180          $item = array(
    166             'email' => $item,
     181            'email' => trim($item),
    167182            'name' => '',
    168183            );
     
    185200    $data = array_map('unformat_email', $data);
    186201  }
    187  
    188   return $data;
    189 }
    190 
    191 /**
    192  * Returns an email address list with minimal email string
     202
     203  $existing = array();
     204  foreach ($data as $i => $entry)
     205  {
     206    if (isset($existing[ $entry['email'] ])
     207    {
     208      unset($data[$i]);
     209    }
     210    else
     211    {
     212      $existing[ $entry['email'] ] = true;
     213    }
     214  }
     215
     216  return array_values($data);
     217}
     218
     219/**
     220 * Returns an email address list with minimal email string.
     221 * @deprecated 2.6
     222 *
    193223 * @param string $email_list - comma separated
    194224 * @return string
     
    212242
    213243/**
    214  * Return an new mail template
     244 * Return an new mail template.
     245 *
    215246 * @param string $email_format - text/html or text/plain
    216247 * @return Template
     
    223254
    224255/**
    225  * Return string email format (text/html or text/plain)
    226  * @param bool is_html
     256 * Return string email format (text/html or text/plain).
     257 *
     258 * @param bool $is_html
    227259 * @return string
    228260 */
     
    233265
    234266/**
    235  * Switch language to specified language
     267 * Switch language to specified language.
    236268 * All entries are push on language stack
     269 *
    237270 * @param string $language
    238271 */
     
    296329
    297330/**
    298  * Switch back language pushed with switch_lang_to function
     331 * Switch back language pushed with switch_lang_to() function.
     332 * @see switch_lang_to()
    299333 */
    300334function switch_lang_back()
     
    318352
    319353/**
    320  * Send a notification email to all administrators
     354 * Send a notification email to all administrators.
    321355 * current user (if admin) is not notified
     356 *
    322357 * @param string|array $subject
    323358 * @param string|array $content
     
    376411
    377412/**
    378  * Send a email to all administrators
     413 * Send a email to all administrators.
    379414 * current user (if admin) is excluded
    380415 * @see pwg_mail()
     
    425460
    426461/**
    427  * Send an email to a group
     462 * Send an email to a group.
    428463 * @see pwg_mail()
    429464 *
    430465 * @param int $group_id
    431466 * @param array $args - as in pwg_mail()
    432  *    @option string language_selected - filters users of the group by language
     467 *       o language_selected: filters users of the group by language [default value empty]
    433468 * @param array $tpl - as in pwg_mail()
    434469 * @return boolean
     
    509544
    510545/**
    511  * sends an email, using Piwigo specific informations
    512  *
    513  * @param string|string[] $to
     546 * Sends an email, using Piwigo specific informations.
     547 *
     548 * @param string|array $to
    514549 * @param array $args
    515550 *       o from: sender [default value webmaster email]
     
    594629  if ($conf_mail['send_bcc_mail_webmaster'])
    595630  {
    596     $Bcc[] = get_webmaster_mail_address();
     631    $Bcc[] = array(
     632      'email' => get_webmaster_mail_address(),
     633      'name' => '',
     634      );
    597635  }
    598636  if (!empty($Bcc))
     
    822860  {
    823861    $ret = $mail->send();
    824     if (!$ret and (!ini_get('display_errors') || is_admin()))
     862    if (!$ret and (!ini_get('display_errors') or is_admin()))
    825863    {
    826864      trigger_error('Mailer Error: ' . $mail->ErrorInfo, E_USER_WARNING);
     
    859897
    860898/**
    861  * Moves CSS rules contained in the <style> tag to inline CSS
    862  * (for compatibility with Gmail and such clients)
     899 * Moves CSS rules contained in the <style> tag to inline CSS.
     900 * Used for compatibility with Gmail and such clients
    863901 * @since 2.6
     902 *
    864903 * @param string $content
    865904 * @return string
     
    875914
    876915/**
    877  * Saves a copy of the mail if _data/tmp
    878  * @param boolean $result
    879  * @param string $to
     916 * Saves a copy of the mail if _data/tmp.
     917 *
     918 * @param boolean $success
     919 * @param PHPMailer $mail
    880920 * @param array $args
    881  * @param PHPMailer $mail
    882  * @return boolean $result
    883921 */
    884922function pwg_send_mail_test($success, $mail, $args)
Note: See TracChangeset for help on using the changeset viewer.