Making WordPress.org

Changeset 4314


Ignore:
Timestamp:
11/01/2016 07:08:47 PM (5 years ago)
Author:
iandunn
Message:

CampTix Tweaks: Add number of expected attendees to t-shirt report

Location:
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/0-logger.php

    r4252 r4314  
    88 *
    99 * SECURITY WARNING: You must redact any sensitive info before it's written to the log file. The best way to do
    10  * that is to add entries to wcorg_log_redact_keys(), so that the caller remain clean. You can also do it before
    11  * passing the data to this function, though. Right now this only redacts array keys, but it can be made more
    12  * sophisticated in the future to handle additional cases.
     10 * that is to add entries to redact_keys(), so that the caller remain clean. You can also do it before
     11 * passing the data to this function, though.
    1312 *
    14  * In the future, it may be helpful to decode JSON values and search them for redactable values, and to allow
    15  * the caller to pass an array of strings that are sensitive and should be redacted. The latter would allow for
    16  * redacting values that aren't known until runtime, and could be helpful in other cases too.
     13 * @todo add current username to every entry, and update wp-cli command parsing regex to match
    1714 *
    1815 * @param string $error_code
     
    4340/**
    4441 * Redact sensitive values from log entries
     42 *
     43 * Right now this only redacts array keys, but it can be made more sophisticated in the future to handle
     44 * additional cases.
     45 *
     46 * In the future, it may be helpful to decode JSON values and search them for redactable values, and to allow
     47 * the caller to pass an array of strings that are sensitive and should be redacted. The latter would allow for
     48 * redacting values that aren't known until runtime, and could be helpful in other cases too.
    4549 *
    4650 * @param array $data
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/camptix-tweaks/camptix-tweaks.php

    r3803 r4314  
    2222add_filter( 'camptix_default_options', __NAMESPACE__ . '\modify_default_options'    );
    2323add_filter( 'camptix_html_message',    __NAMESPACE__ . '\render_html_emails', 10, 2 );
     24add_action( 'camptix_tshirt_report_intro', __NAMESPACE__ . '\tshirt_report_intro_message', 10, 3 );
    2425
    2526
     
    396397    return $html_message;
    397398}
     399
     400/**
     401 * Extend the introduction message for each camp in the tshirt report
     402 *
     403 * @param string $message
     404 * @param int    $site_id
     405 * @param array  $sizes
     406 *
     407 * @return string
     408 */
     409function tshirt_report_intro_message( $message, $site_id, $sizes ) {
     410    switch_to_blog( $site_id );
     411
     412    $wordcamp = get_wordcamp_post();
     413
     414    if ( ! empty( $wordcamp->meta['Number of Anticipated Attendees'][0] ) ) {
     415        $message = sprintf(
     416            "<p>This camp is expecting %d attendees.</p>",
     417            $wordcamp->meta['Number of Anticipated Attendees'][0]
     418        );
     419    }
     420
     421    restore_current_blog();
     422    return $message;
     423}
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wp-cli-commands/miscellaneous.php

    r4252 r4314  
    114114     * wp wc-misc format-log "$(grep 'bar' /var/log/php-errors.log)" --foreign=ignore
    115115     *
     116     * @todo Sometimes example passing entries as command line param fails because it passes the length limit.
     117     *       Add an example of a good workaround for that.
     118     *
    116119     * @subcommand format-log
    117120     *
Note: See TracChangeset for help on using the changeset viewer.