Changeset 743 for trunk/lib


Ignore:
Timestamp:
Apr 23, 2021 11:00:26 PM (3 years ago)
Author:
anonymous
Message:

Add SC_DUMP_JSON flag to dump(). Update comments.

Location:
trunk/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/App.inc.php

    r742 r743  
    115115
    116116        // Human-readable format used to display dates.
    117         'date_format' => 'd M Y',
    118         'time_format' => 'h:i A',
    119         'lc_date_format' => '%e %b %Y', // Localized date for strftime() https://www.php.net/manual/en/function.strftime.php
     117        'date_format' => 'd M Y', // Format accepted by DateTimeInterface::format() https://www.php.net/manual/en/datetime.format.php
     118        'time_format' => 'h:i A', // Format accepted by DateTimeInterface::format() https://www.php.net/manual/en/datetime.format.php
     119        'lc_date_format' => '%d %b %Y', // Localized date for strftime() https://www.php.net/manual/en/function.strftime.php
    120120        'lc_time_format' => '%k:%M', // Localized time for strftime() https://www.php.net/manual/en/function.strftime.php
    121121        'sql_date_format' => '%e %b %Y',
     
    18801880
    18811881        try {
    1882             // Create a DateTime object and conver the timezone from server to user.
     1882            // Create a DateTime object and convert the timezone from server to user.
    18831883            $dt = $this->convertTZ($datetime, $this->getParam('php_timezone'), $this->getParam('user_timezone'));
    18841884        } catch (Exception $e) {
  • trunk/lib/Email.inc.php

    r735 r743  
    294294        if (preg_match('/({[^}]+})/', $final_body, $unreplaced_match)) {
    295295            unset($unreplaced_match[0]);
    296             $app->logMsg(sprintf('Cannot get email body. Unreplaced variable %s in template %s', getDump($unreplaced_match)), LOG_ERR, __FILE__, __LINE__);
     296            $app->logMsg(sprintf('Cannot get email body. Unreplaced variable(s) "%s" in template "%s"', getDump($unreplaced_match), $this->_template_filename), LOG_ERR, __FILE__, __LINE__);
    297297            return false;
    298298        }
     
    352352        if (preg_match('/({[^}]+})/', $final_body, $unreplaced_match)) {
    353353            unset($unreplaced_match[0]);
    354             $app->logMsg(sprintf('Unreplaced variable "%s" in template "%s"', getDump($unreplaced_match), $this->_template_filename), LOG_ERR, __FILE__, __LINE__);
     354            $app->logMsg(sprintf('Unreplaced variable(s) "%s" in template "%s"', getDump($unreplaced_match), $this->_template_filename), LOG_ERR, __FILE__, __LINE__);
     355            return false;
    355356        }
    356357
  • trunk/lib/Utilities.inc.php

    r742 r743  
    3838define('SC_DUMP_VAR_DUMP', 1);
    3939define('SC_DUMP_VAR_EXPORT', 2);
     40define('SC_DUMP_JSON', 3);
    4041function dump($var, $display=false, $dump_method=SC_DUMP_PRINT_R, $file='', $line='')
    4142{
     
    7374    case SC_DUMP_VAR_EXPORT:
    7475        var_export($var);
     76        break;
     77
     78    case SC_DUMP_JSON:
     79        json_encode($var, JSON_PRETTY_PRINT);
    7580        break;
    7681    }
     
    15431548*
    15441549* @access   public
    1545 * @param    string  $url    URL to a file.
    1546 * @return   bool            True if the resource exists, false otherwise.
     1550* @param    string  $url     URL to a file.
     1551* @param    int     $timeout The maximum number of seconds to allow the HTTP query to execute.
     1552* @return   bool             True if the resource exists, false otherwise.
    15471553* @author   Quinn Comendant <quinn@strangecode.com>
    15481554* @version  2.0
Note: See TracChangeset for help on using the changeset viewer.