Function __global->do_comcode_attachments

Definitions

sources/attachments2.php

  • Get an array containing new Comcode, and Tempcode. The function wraps the normal comcode_to_tempcode function. The function will do attachment management, including deleting of attachments that have become unused due to editing of some Comcode and removing of the reference.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$comcode LONG_TEXT No No required parameter N/A N/A The unparsed Comcode that references the attachments
$type ID_TEXT No No null N/A N/A The type the attachment will be used for (e.g. download)
$id ID_TEXT No No Blank (empty string) N/A N/A The ID the attachment will be used for
$previewing_only boolean No No False N/A N/A Whether we are only previewing the attachments (i.e. don't store them!)
$db ?object No No Null N/A N/A The database connector to use (null: standard site connector)
$insert_as_admin ?boolean No No Null N/A N/A Whether to insert it as an admin (any Comcode parsing will be carried out with admin privileges) (null: autodetect)
$for_member ?MEMBER No No Null N/A N/A The member to use for ownership permissions (null: current member)

Returns

  • A map containing 'Comcode' (after substitution for tying down the new attachments) and 'tempcode'
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get an array containing new Comcode, and Tempcode. The function wraps the normal comcode_to_tempcode function. The function will do attachment management, including deleting of attachments that have become unused due to editing of some Comcode and removing of the reference.
 *
 * @param  LONG_TEXT $comcode The unparsed Comcode that references the attachments
 * @param  ID_TEXT $type The type the attachment will be used for (e.g. download)
 * @param  ID_TEXT $id The ID the attachment will be used for
 * @param  boolean $previewing_only Whether we are only previewing the attachments (i.e. don't store them!)
 * @param  ?object $db The database connector to use (null: standard site connector)
 * @param  ?boolean $insert_as_admin Whether to insert it as an admin (any Comcode parsing will be carried out with admin privileges) (null: autodetect)
 * @param  ?MEMBER $for_member The member to use for ownership permissions (null: current member)
 * @return array A map containing 'Comcode' (after substitution for tying down the new attachments) and 'tempcode'
 */

function do_comcode_attachments(string $comcode, string $type = 'null', string $id = '', bool $previewing_only = false, ?object $db = null, ?bool $insert_as_admin = null, ?int $for_member = null) : array