| @@ -18,12 +18,8 @@ | ||
| 18 | 18 | if ( is_admin() ) { |
| 19 | 19 | $rating_date = $this->create_rating_date(); |
| 20 | 20 | if ( time() > $rating_date ) { |
| 21 | 21 | add_action( 'admin_notices', array( $this, 'admin_notices_rating' ) ); |
| 22 | - add_filter( 'safe_style_css', function( $styles ) { | |
| 23 | - $styles[] = 'display'; | |
| 24 | - return $styles; | |
| 25 | - } ); | |
| 26 | 22 | } |
| 27 | 23 | } |
| 28 | 24 | } |
| 29 | 25 | |
| @@ -34,11 +30,11 @@ | ||
| 34 | 30 | |
| 35 | 31 | function create_rating_date() { |
| 36 | 32 | $rating_date = get_option( $this->prefix . '_rating_date' ); |
| 37 | 33 | if ( empty( $rating_date ) ) { |
| 38 | - $two_weeks = strtotime( '+2 weeks' ); | |
| 39 | - $three_weeks = strtotime( '+3 weeks' ); | |
| 40 | - $rating_date = mt_rand( $two_weeks, $three_weeks ); | |
| 34 | + $two_months = strtotime( '+2 months' ); | |
| 35 | + $six_months = strtotime( '+4 months' ); | |
| 36 | + $rating_date = mt_rand( $two_months, $six_months ); | |
| 41 | 37 | update_option( $this->prefix . '_rating_date', $rating_date, false ); |
| 42 | 38 | } |
| 43 | 39 | return $rating_date; |
| 44 | 40 | } |
| @@ -56,89 +52,41 @@ | ||
| 56 | 52 | update_option( $this->prefix . '_rating_date', $twenty_years, false ); |
| 57 | 53 | return; |
| 58 | 54 | } |
| 59 | 55 | else if ( isset( $_POST[$this->prefix . '_did_it'] ) ) { |
| 60 | - $twenty_years = strtotime( '+100 years' ); | |
| 56 | + $twenty_years = strtotime( '+10 years' ); | |
| 61 | 57 | update_option( $this->prefix . '_rating_date', $twenty_years, false ); |
| 62 | 58 | return; |
| 63 | 59 | } |
| 64 | 60 | $rating_date = get_option( $this->prefix . '_rating_date' ); |
| 65 | - $html = wp_kses_post( '<div class="notice notice-success" data-rating-date="' . | |
| 66 | - date( 'Y-m-d', $rating_date ) . '">' ); | |
| 67 | - $esc_nice_name = esc_attr( $this->nice_name_from_file( $this->mainfile ) ); | |
| 68 | - if ( $esc_nice_name === 'Wp Retina 2x Pro' ) { | |
| 69 | - $esc_nice_name = "Perfect Images Pro"; | |
| 70 | - } | |
| 71 | - else if ( $esc_nice_name === 'Wp Retina 2x' ) { | |
| 72 | - $esc_nice_name = "Perfect Images"; | |
| 73 | - } | |
| 74 | - $esc_short_url = esc_attr( $this->nice_short_url_from_file( $this->mainfile ) ); | |
| 75 | - $escaped_prefix = $this->prefix; | |
| 61 | + $html = '<div class="notice notice-success" data-rating-date="' . date( 'Y-m-d', $rating_date ) . '">'; | |
| 76 | 62 | $html .= '<p style="font-size: 100%;">'; |
| 77 | - // Translators: %1$s is a plugin nicename, %2$s is a short url (slug) | |
| 78 | 63 | $html .= sprintf( |
| 79 | - __( '<h2 class="title">You have been using <b>%1$s</b> for some time now. Thank you 💕</h2>Could you take one minute and write a <b>little review</b> for me? That would <b>really</b> bring me joy and motivation 🥰<br />In the review, don\'t hesitate to share your feature requests and remarks. I will try my best! | |
| 80 | - ', $this->domain ), $esc_nice_name | |
| 64 | + // translators: %1$s is a plugin nicename, %2$s is a short url (slug) | |
| 65 | + __( 'You have been using <b>%1$s</b> for some time now. Thank you! Could you kindly share your opinion with me, along with, maybe, features you would like to see implemented? Then, please <a style="font-weight: bold; color: #b926ff;" target="_blank" href="https://wordpress.org/support/plugin/%2$s/reviews/?rate=5#new-post">write a little review</a>. That will also bring me joy and motivation! I will get back to you :)', $this->domain ), | |
| 66 | + $this->nice_name_from_file( $this->mainfile ), | |
| 67 | + $this->nice_short_url_from_file( $this->mainfile ) | |
| 81 | 68 | ); |
| 82 | - $html .= '<div style="padding: 20px 0 12px 0; display: flex; align-items: center;">'; | |
| 83 | - $html .= '<a target="_blank" class="button button-primary" style="margin-right: 10px;" | |
| 84 | - href="https://wordpress.org/support/plugin/' . $esc_short_url . '/reviews/?rate=5#new-post"> | |
| 85 | - ✍🏼 Yes, let\'s write it now! | |
| 86 | - </a> | |
| 87 | - <form method="post" action="" style="margin-right: 10px;"> | |
| 88 | - <input type="hidden" name="' . $escaped_prefix . '_did_it" value="true"> | |
| 69 | + $html .= '<p> | |
| 70 | + <form method="post" action="" style="float: right;"> | |
| 71 | + <input type="hidden" name="' . $this->prefix . '_never_remind_me" value="true"> | |
| 72 | + <input type="submit" name="submit" id="submit" class="button button-red" value="' | |
| 73 | + . __( 'Never remind me!', $this->domain ) . '"> | |
| 74 | + </form> | |
| 75 | + <form method="post" action="" style="float: right; margin-right: 10px;"> | |
| 76 | + <input type="hidden" name="' . $this->prefix . '_remind_me" value="true"> | |
| 89 | 77 | <input type="submit" name="submit" id="submit" class="button button-primary" value="' |
| 90 | - . __( '🥰 I did it', $this->domain ) . '"> | |
| 78 | + . __( 'Remind me in a few weeks...', $this->domain ) . '"> | |
| 91 | 79 | </form> |
| 92 | - | |
| 93 | - <div style="flex: auto;"></div> | |
| 94 | - | |
| 95 | - <form method="post" action="" style="margin-right: 10px;"> | |
| 96 | - <input type="hidden" name="' . $escaped_prefix . '_remind_me" value="true"> | |
| 80 | + <form method="post" action="" style="float: right; margin-right: 10px;"> | |
| 81 | + <input type="hidden" name="' . $this->prefix . '_did_it" value="true"> | |
| 97 | 82 | <input type="submit" name="submit" id="submit" class="button button-primary" value="' |
| 98 | - . __( '⏰ Remind me later', $this->domain ) . '"> | |
| 83 | + . __( 'Yes, I did it!', $this->domain ) . '"> | |
| 99 | 84 | </form> |
| 100 | - | |
| 101 | - <form method="post" action=""> | |
| 102 | - <input type="hidden" name="' . $escaped_prefix . '_never_remind_me" value="true"> | |
| 103 | - <input type="submit" name="submit" id="submit" class="button-link" style="font-size: small;" value="' | |
| 104 | - . __( 'Hide this', $this->domain ) . '"> | |
| 105 | - </form> | |
| 106 | - </div>'; | |
| 85 | + <div style="clear: both;"></div> | |
| 86 | + </p>'; | |
| 107 | 87 | $html .= '</div>'; |
| 108 | - echo wp_kses( $html, array( | |
| 109 | - 'div' => array( | |
| 110 | - 'class' => array(), | |
| 111 | - 'data-rating-date' => array(), | |
| 112 | - 'style' => array(), | |
| 113 | - ), | |
| 114 | - 'p' => array( | |
| 115 | - 'style' => array(), | |
| 116 | - ), | |
| 117 | - 'h2' => array( | |
| 118 | - 'class' => array(), | |
| 119 | - ), | |
| 120 | - 'b' => array(), | |
| 121 | - 'a' => array( | |
| 122 | - 'href' => array(), | |
| 123 | - 'target' => array(), | |
| 124 | - 'class' => array(), | |
| 125 | - 'style' => array(), | |
| 126 | - ), | |
| 127 | - 'form' => array( | |
| 128 | - 'method' => array(), | |
| 129 | - 'action' => array(), | |
| 130 | - 'class' => array(), | |
| 131 | - 'style' => array(), | |
| 132 | - ), | |
| 133 | - 'input' => array( | |
| 134 | - 'type' => array(), | |
| 135 | - 'name' => array(), | |
| 136 | - 'value' => array(), | |
| 137 | - 'id' => array(), | |
| 138 | - 'class' => array(), | |
| 139 | - ), | |
| 140 | - ) ); | |
| 88 | + wp_kses_post( $html ); | |
| 141 | 89 | } |
| 142 | 90 | |
| 143 | 91 | function nice_short_url_from_file( $file ) { |
| 144 | 92 | $info = pathinfo( $file ); |