'; $out .= ''; $out .= ''; $out .= '' . esc_html( $title ) . ''; $out .= ''; $out .= ''; $out .= '
'; $out .= ''; // The strip on top. It carries no text, it is there so the colour is seen // even in a client that throws the border away. $out .= ''; // ---- the head: what came in, from which form, on which site ---- $out .= ''; // ---- the answers ---- $out .= ''; // ---- the way in ---- if ( '' !== $url ) { $out .= ''; } // ---- the foot ---- $foot = array(); if ( '' !== $reply ) { $foot[] = esc_html( sprintf( /* translators: %s: the visitor's email address. */ __( 'Hit reply and your answer goes straight to %s.', '2ranq-forms' ), $reply ) ); } $foot[] = esc_html( sprintf( /* translators: 1: form name, 2: entry number. */ __( 'Form: %1$s · Entry number %2$d', '2ranq-forms' ), $title, $entry_id ) ); $out .= ''; $out .= '
 
'; $out .= '
' . esc_html__( 'New entry', '2ranq-forms' ) . '
'; $out .= '
' . esc_html( $title ) . '
'; $under = trim( $site . ( '' !== $site && '' !== $date ? ' · ' : '' ) . $date ); if ( '' !== $under ) { $out .= '
' . esc_html( $under ) . '
'; } $out .= '
'; $out .= ''; $last = count( $rows ) - 1; foreach ( array_values( $rows ) as $i => $row ) { $label = isset( $row['label'] ) ? (string) $row['label'] : ''; $value = isset( $row['value'] ) ? (string) $row['value'] : ''; $edge = 'border-top:1px solid #e5e7eb;' . ( $i === $last ? 'border-bottom:1px solid #e5e7eb;' : '' ); $out .= ''; } $out .= '
'; $out .= '
' . esc_html( $label ) . '
'; // An empty answer gets a dash. A blank space would read as a fault in the // message rather than as an answer nobody gave. $shown = '' === trim( $value ) ? '—' : nl2br( esc_html( $value ) ); $out .= '
' . $shown . '
'; $out .= '
'; $out .= ''; $out .= '
'; $out .= '' . esc_html__( 'Open this entry', '2ranq-forms' ) . ''; $out .= '
'; $out .= '
' . implode( '
', $foot ) . '
'; $out .= '
'; // 🔴 Poruka se lomi u redove na granicama reda tabele. // // Bez ovoga cela kartica je JEDAN red od nekoliko hiljada znakova. Posta // takav red ne sme da prenese kakav jeste, pa ga PHPMailer prepakuje u // `quoted-printable`, gde znak jednakosti postaje oznaka. Adresa u dugmetu // je puna znakova jednakosti, `form_id=768`, i dovoljno je da je jedna // stanica na putu razveze dvaput pa da od nje ostane `form_idv8`. Izmereno // na pravoj poruci koja je stigla u Gmail. // // Prelom ide samo IZMEDJU tagova, nikad unutar teksta, pa se izgled ne menja. return str_replace( array( '', '' ), array( "\n", "\n" ), $out ); } /** * Lets a colour through only if it is a hex number. * * Whatever else arrives, the default is used. The value ends up inside a * `style` attribute, so this is a gate and not a convenience. * * @param string $raw The colour as saved. * * @return string */ public static function color( $raw ) { $raw = is_scalar( $raw ) ? strtolower( trim( (string) $raw ) ) : ''; if ( ! preg_match( '/^#([0-9a-f]{3}|[0-9a-f]{6})$/', $raw ) ) { return self::DEFAULT_COLOR; } // Three digits are written out to six, so the reading below has one shape // to deal with. if ( 4 === strlen( $raw ) ) { $raw = '#' . $raw[1] . $raw[1] . $raw[2] . $raw[2] . $raw[3] . $raw[3]; } return $raw; } /** * Which colour the text on that background can be. * * Our green is a light colour, and white letters on it cannot be read. So the * button keeps black text when the background is light. This is counted from * the brightness, it is not a setting, because a person picking a colour is * not thinking about contrast. * * @param string $hex The background, six digits with a hash. * * @return string */ public static function ink( $hex ) { $r = hexdec( substr( $hex, 1, 2 ) ) / 255; $g = hexdec( substr( $hex, 3, 2 ) ) / 255; $b = hexdec( substr( $hex, 5, 2 ) ) / 255; // Relative brightness the way the accessibility guidelines count it. Green // weighs the most because the eye sees it best. $parts = array(); foreach ( array( $r, $g, $b ) as $one ) { $parts[] = $one <= 0.03928 ? $one / 12.92 : pow( ( $one + 0.055 ) / 1.055, 2.4 ); } $light = ( 0.2126 * $parts[0] ) + ( 0.7152 * $parts[1] ) + ( 0.0722 * $parts[2] ); // The crossing point where black and white stand equally well. return $light > 0.179 ? '#111111' : '#ffffff'; } }