Changeset 25550


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

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

Location:
trunk/include
Files:
4 edited

Legend:

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

    r25507 r25550  
    104104}
    105105
     106/** no option for mkgetdir() */
    106107define('MKGETDIR_NONE', 0);
     108/** sets mkgetdir() recursive */
    107109define('MKGETDIR_RECURSIVE', 1);
     110/** sets mkgetdir() exit script on error */
    108111define('MKGETDIR_DIE_ON_ERROR', 2);
     112/** sets mkgetdir() add a index.htm file */
    109113define('MKGETDIR_PROTECT_INDEX', 4);
     114/** sets mkgetdir() add a .htaccess file*/
    110115define('MKGETDIR_PROTECT_HTACCESS', 8);
    111 define('MKGETDIR_DEFAULT', 7);
     116/** default options for mkgetdir() = MKGETDIR_RECURSIVE | MKGETDIR_DIE_ON_ERROR | MKGETDIR_PROTECT_INDEX */
     117define('MKGETDIR_DEFAULT', MKGETDIR_RECURSIVE | MKGETDIR_DIE_ON_ERROR | MKGETDIR_PROTECT_INDEX);
     118
    112119/**
    113120 * creates directory if not exists and ensures that directory is writable
  • 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)
  • trunk/include/functions_metadata.inc.php

    r24968 r25550  
    2323
    2424/**
    25  * returns informations from IPTC metadata, mapping is done at the beginning
    26  * of the function
     25 * @package functions\metadata
     26 */
     27
     28
     29/**
     30 * returns informations from IPTC metadata, mapping is done in this function.
    2731 *
    2832 * @param string $filename
     33 * @param array $map
    2934 * @return array
    3035 */
     
    8186
    8287/**
    83  * return a cleaned IPTC value
     88 * return a cleaned IPTC value.
    8489 *
    85  * @param string value
     90 * @param string $value
    8691 * @return string
    8792 */
     
    128133
    129134/**
    130  * returns informations from EXIF metadata, mapping is done at the beginning
    131  * of the function
     135 * returns informations from EXIF metadata, mapping is done in this function.
    132136 *
    133137 * @param string $filename
     138 * @param array $map
    134139 * @return array
    135140 */
     
    181186  return $result;
    182187}
     188
    183189?>
  • trunk/include/functions_picture.inc.php

    r19703 r25550  
    2222// +-----------------------------------------------------------------------+
    2323
     24/**
     25 * @package functions\picture
     26 */
    2427
    25 /*
    26  * get slideshow default params into array
     28
     29/**
     30 * Returns slideshow default params.
     31 * - period
     32 * - repeat
     33 * - play
    2734 *
    28  * @param void
    29  *
    30  * @return slideshow default values into array
     35 * @return array
    3136 */
    3237function get_default_slideshow_params()
     
    4146}
    4247
    43 /*
    44  * check and correct slideshow params from array
     48/**
     49 * Checks and corrects slideshow params
    4550 *
    46  * @param array of params
    47  *
    48  * @return slideshow corrected values into array
     51 * @param array $params
     52 * @return array
    4953 */
    50 function correct_slideshow_params($params = array())
     54function correct_slideshow_params($params=array())
    5155{
    5256  global $conf;
     
    6468}
    6569
    66 /*
    67  * Decode slideshow string params into array
     70/**
     71 * Decodes slideshow string params into array
    6872 *
    69  * @param string params like ""
    70  *
    71  * @return slideshow values into array
     73 * @param string $encode_params
     74 * @return array
    7275 */
    73 function decode_slideshow_params($encode_params = null)
     76function decode_slideshow_params($encode_params=null)
    7477{
    7578  global $conf;
     
    106109}
    107110
    108 /*
    109  * Encode slideshow array params into array
     111/**
     112 * Encodes slideshow array params into a string
    110113 *
    111  * @param array params
    112  *
    113  * @return slideshow values into string
     114 * @param array $decode_params
     115 * @return string
    114116 */
    115 function encode_slideshow_params($decode_params = array())
     117function encode_slideshow_params($decode_params=array())
    116118{
    117119  global $conf;
     
    128130  return $result;
    129131}
     132
    130133?>
Note: See TracChangeset for help on using the changeset viewer.