Function __global->__comcode_to_tempcode

Definitions

sources/comcode_compiler.php

  • Convert the specified Comcode (text format) into a Tempcode tree. You shouldn't output the Tempcode tree to the browser, as it looks really horrible. If you are in a rare case where you need to output directly (not through templates), you should call the evaluate method on the Tempcode object, to convert it into a string.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: object

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$comcode LONG_TEXT No No required parameter N/A N/A The Comcode to convert
$source_member MEMBER No No required parameter N/A N/A The member the evaluation is running as. This is a security issue, and you should only run as an administrator if you have considered where the Comcode came from carefully
$as_admin boolean No No required parameter N/A N/A Whether to explicitly execute this with admin rights. There are a few rare situations where this should be done, for data you know didn't come from a member, but is being evaluated by one.
$pass_id ?string No No required parameter N/A N/A A special identifier that can identify this resource in a sea of our resources of this class; usually this can be ignored, but may be used to provide a binding between JavaScript in evaluated Comcode, and the surrounding environment (null: no explicit binding)
$db ?object No No required parameter N/A N/A The database connector to use (null: none; only do this for very simple Comcode)
$flags integer No No 0 N/A N/A A bitmask of COMCODE_* flags
$highlight_bits array No No [] N/A N/A A list of words to highlight
$on_behalf_of_member ?MEMBER No No Null N/A N/A The member we are running on behalf of, with respect to how attachments are handled; we may use this members attachments that are already within this post, and our new attachments will be handed to this member (null: member evaluating)

Returns

  • The Tempcode generated
  • Type: Tempcode
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Convert the specified Comcode (text format) into a Tempcode tree. You shouldn't output the Tempcode tree to the browser, as it looks really horrible. If you are in a rare case where you need to output directly (not through templates), you should call the evaluate method on the Tempcode object, to convert it into a string.
 *
 * @param  LONG_TEXT $comcode The Comcode to convert
 * @param  MEMBER $source_member The member the evaluation is running as. This is a security issue, and you should only run as an administrator if you have considered where the Comcode came from carefully
 * @param  boolean $as_admin Whether to explicitly execute this with admin rights. There are a few rare situations where this should be done, for data you know didn't come from a member, but is being evaluated by one.
 * @param  ?string $pass_id A special identifier that can identify this resource in a sea of our resources of this class; usually this can be ignored, but may be used to provide a binding between JavaScript in evaluated Comcode, and the surrounding environment (null: no explicit binding)
 * @param  ?object $db The database connector to use (null: none; only do this for very simple Comcode)
 * @param  integer $flags A bitmask of COMCODE_* flags
 * @param  array $highlight_bits A list of words to highlight
 * @param  ?MEMBER $on_behalf_of_member The member we are running on behalf of, with respect to how attachments are handled; we may use this members attachments that are already within this post, and our new attachments will be handed to this member (null: member evaluating)
 * @return Tempcode The Tempcode generated
 */

function __comcode_to_tempcode(string $comcode, int $source_member, bool $as_admin, ?string $pass_id, ?object $db, int $flags = 0, array $highlight_bits = [], ?int $on_behalf_of_member = null) : object