Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 27
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php // phpcs:ignore Squiz.Commenting.FileComment.MissingPackageTag
2/**
3 * This is loaded inside the static context of class Colors_Manager
4 */
5
6// Don't bother if the theme doesn't have annotations.
7if ( ! self::has_annotations() ) {
8    return;
9}
10
11$url = admin_url( 'customize.php' );
12// move into preview mode for un-upgraded users
13if ( ! CustomDesign::is_upgrade_active() ) {
14    $url = add_query_arg(
15        array(
16            'action'   => 'custom-design-preview',
17            'state'    => 'on',
18            'source'   => 'custom-background',
19            '_wpnonce' => wp_create_nonce( 'custom-design-preview' ),
20        ),
21        $url
22    );
23}
24// add hash to open colors section
25$url .= '#colors';
26
27$img = sprintf(
28    '<a href="%s"><img src="%s" alt="%s" /></a>',
29    esc_url( $url ),
30    esc_url( plugins_url( '/images/colors-screenshot.png', __FILE__ ) ),
31    esc_attr__( 'Custom Colors interface', 'wpcomsh' )
32);
33
34if ( CustomDesign::is_upgrade_active() ) {
35    $message  = esc_html__( 'You can do far more than just customize your background color and image as part of your Custom Design upgrade. Choose from great palettes and background patterns.', 'wpcomsh' );
36    $message .= ' <a href="' . esc_url( $url ) . '">' . esc_html__( 'Check it out!', 'wpcomsh' ) . '</a>';
37} else {
38    $message  = __( 'Did you know that you can do far more than just set your background color and image in the Colors tool in our Custom Design, part of the Premium Plan?', 'wpcomsh' );
39    $message .= ' <a href="' . esc_url( $url ) . '">' . esc_html__( 'Preview it now!', 'wpcomsh' ) . '</a>';
40}
41
42?>
43<div class="color-admin-notice hidden">
44    <p><?php echo $img . ' ' . $message; /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Both vars have HTML that is escaped above. */ ?></p>
45</div>
46<script>
47jQuery(document).ready(function($){
48    $( '.color-admin-notice' ).insertAfter( '.wrap > h2' ).removeClass( 'hidden' );
49});
50</script>