diff --git a/assets/css/bsf-custom-fonts.css b/assets/css/bsf-custom-fonts.css
index 2fd56846..c036fdf7 100644
--- a/assets/css/bsf-custom-fonts.css
+++ b/assets/css/bsf-custom-fonts.css
@@ -1,6 +1,6 @@
.bsf-custom-fonts-file-wrap.form-field{
- position: relative;
- margin: 1.5em 0;
+ position: relative;
+ margin: 1.5em 0;
}
.bsf-custom-fonts-upload.button {
float: right;
@@ -10,4 +10,44 @@
.bsf-custom-font-select-field {
width: 95%;
+}
+
+.astra-review-notice-container {
+ display: flex;
+ align-items: center;
+ padding-top: 10px;
+}
+
+.astra-review-notice-container .dashicons {
+ font-size: 1.4em;
+ padding-left: 10px;
+}
+
+.astra-review-notice-container a {
+ padding-left: 5px;
+ text-decoration: none;
+}
+
+.astra-review-notice-container .dashicons:first-child {
+ padding-left: 0;
+}
+
+.notice-image img {
+ max-width: 90px;
+}
+
+.notice-content .notice-heading {
+ padding-bottom: 5px;
+}
+
+.notice-content {
+ margin-left: 15px;
+}
+
+.notice-container {
+ padding-top: 10px;
+ padding-bottom: 10px;
+ display: flex;
+ justify-content: left;
+ align-items: center;
}
\ No newline at end of file
diff --git a/assets/images/custom-fonts-icon.png b/assets/images/custom-fonts-icon.png
new file mode 100644
index 00000000..cd07b93c
Binary files /dev/null and b/assets/images/custom-fonts-icon.png differ
diff --git a/custom-fonts.php b/custom-fonts.php
index fa2f1293..f0a34fff 100644
--- a/custom-fonts.php
+++ b/custom-fonts.php
@@ -31,3 +31,60 @@
* BSF Custom Fonts
*/
require_once BSF_CUSTOM_FONTS_DIR . 'classes/class-bsf-custom-fonts.php';
+require_once BSF_CUSTOM_FONTS_DIR . 'includes/lib/notices/class-astra-notices.php';
+
+if ( ! function_exists( 'register_notices' ) ) :
+
+ /**
+ * Ask Theme Rating
+ *
+ * @since 1.4.0
+ */
+ function register_notices() {
+ $image_path = BSF_CUSTOM_FONTS_URI . 'assets/images/custom-fonts-icon.png';
+ Astra_Notices::add_notice(
+ array(
+ 'id' => 'custom-fonts-rating',
+ 'type' => '',
+ 'message' => sprintf(
+ '
+
+ ',
+ $image_path,
+ __( 'Hello! Seems like you have used Custom Fonts to build this website — Thanks a ton!', 'custom-fonts' ),
+ __( 'Could you please do us a BIG favor and give it a 5-star rating on WordPress? This would boost our motivation and help other users make a comfortable decision while choosing the Custom Fonts.', 'custom-fonts' ),
+ 'https://wordpress.org/support/plugin/custom-fonts/reviews/?filter=5#new-post',
+ __( 'Ok, you deserve it', 'custom-fonts' ),
+ MONTH_IN_SECONDS,
+ __( 'Nope, maybe later', 'custom-fonts' ),
+ __( 'I already did', 'custom-fonts' )
+ ),
+ 'repeat-notice-after' => MONTH_IN_SECONDS,
+ 'priority' => 25,
+ 'display-with-other-notices' => false,
+ )
+ );
+ }
+
+ add_action( 'admin_notices', 'register_notices' );
+
+endif;
+
diff --git a/includes/lib/notices/class-astra-notices.php b/includes/lib/notices/class-astra-notices.php
new file mode 100644
index 00000000..607b5f65
--- /dev/null
+++ b/includes/lib/notices/class-astra-notices.php
@@ -0,0 +1,328 @@
+ Create custom close notice link in the notice markup. E.g.
+ * ``
+ * It close the notice for 30 days.
+ *
+ * @package Astra Sites
+ * @since 1.4.0
+ */
+
+if ( ! class_exists( 'Astra_Notices' ) ) :
+
+ /**
+ * Astra_Notices
+ *
+ * @since 1.4.0
+ */
+ class Astra_Notices {
+
+ /**
+ * Notices
+ *
+ * @access private
+ * @var array Notices.
+ * @since 1.4.0
+ */
+ private static $version = '1.0.0';
+
+ /**
+ * Notices
+ *
+ * @access private
+ * @var array Notices.
+ * @since 1.4.0
+ */
+ private static $notices = array();
+
+ /**
+ * Instance
+ *
+ * @access private
+ * @var object Class object.
+ * @since 1.4.0
+ */
+ private static $instance;
+
+ /**
+ * Initiator
+ *
+ * @since 1.4.0
+ * @return object initialized object of class.
+ */
+ public static function get_instance() {
+ if ( ! isset( self::$instance ) ) {
+ self::$instance = new self;
+ }
+ return self::$instance;
+ }
+
+ /**
+ * Constructor
+ *
+ * @since 1.4.0
+ */
+ public function __construct() {
+ add_action( 'admin_notices', array( $this, 'show_notices' ), 30 );
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
+ add_action( 'wp_ajax_astra-notice-dismiss', array( $this, 'dismiss_notice' ) );
+ add_filter( 'wp_kses_allowed_html', array( $this, 'add_data_attributes' ), 10, 2 );
+ }
+
+ /**
+ * Filters and Returns a list of allowed tags and attributes for a given context.
+ *
+ * @param Array $allowedposttags Array of allowed tags.
+ * @param String $context Context type (explicit).
+ * @since 1.4.0
+ * @return Array
+ */
+ function add_data_attributes( $allowedposttags, $context ) {
+ $allowedposttags['a']['data-repeat-notice-after'] = true;
+
+ return $allowedposttags;
+ }
+
+ /**
+ * Add Notice.
+ *
+ * @since 1.4.0
+ * @param array $args Notice arguments.
+ * @return void
+ */
+ public static function add_notice( $args = array() ) {
+ self::$notices[] = $args;
+ }
+
+ /**
+ * Dismiss Notice.
+ *
+ * @since 1.4.0
+ * @return void
+ */
+ function dismiss_notice() {
+ $notice_id = ( isset( $_POST['notice_id'] ) ) ? sanitize_key( $_POST['notice_id'] ) : '';
+ $repeat_notice_after = ( isset( $_POST['repeat_notice_after'] ) ) ? absint( $_POST['repeat_notice_after'] ) : '';
+ $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : '';
+
+ if ( false === wp_verify_nonce( $nonce, 'astra-notices' ) ) {
+ wp_send_json_error( _e( 'WordPress Nonce not validated.', 'astra-sites' ) );
+ }
+
+ // Valid inputs?
+ if ( ! empty( $notice_id ) ) {
+
+ if ( ! empty( $repeat_notice_after ) ) {
+ set_transient( $notice_id, true, $repeat_notice_after );
+ } else {
+ update_user_meta( get_current_user_id(), $notice_id, true );
+ }
+
+ wp_send_json_success();
+ }
+
+ wp_send_json_error();
+ }
+
+ /**
+ * Enqueue Scripts.
+ *
+ * @since 1.4.0
+ * @return void
+ */
+ function enqueue_scripts() {
+ wp_register_script( 'astra-notices', self::_get_uri() . 'notices.js', array( 'jquery' ), null, self::$version );
+ wp_localize_script(
+ 'astra-notices',
+ 'astraNotices',
+ array(
+ '_notice_nonce' => wp_create_nonce( 'astra-notices' ),
+ )
+ );
+ }
+
+ /**
+ * Rating priority sort
+ *
+ * @since 1.5.2
+ * @param array $array1 array one.
+ * @param array $array2 array two.
+ * @return array
+ */
+ function sort_notices( $array1, $array2 ) {
+ if ( ! isset( $array1['priority'] ) ) {
+ $array1['priority'] = 10;
+ }
+ if ( ! isset( $array2['priority'] ) ) {
+ $array2['priority'] = 10;
+ }
+
+ return $array1['priority'] - $array2['priority'];
+ }
+
+ /**
+ * Notice Types
+ *
+ * @since 1.4.0
+ * @return void
+ */
+ function show_notices() {
+
+ $defaults = array(
+ 'id' => '', // Optional, Notice ID. If empty it set `astra-notices-id-<$array-index>`.
+ 'type' => 'info', // Optional, Notice type. Default `info`. Expected [info, warning, notice, error].
+ 'message' => '', // Optional, Message.
+ 'show_if' => true, // Optional, Show notice on custom condition. E.g. 'show_if' => if( is_admin() ) ? true, false, .
+ 'repeat-notice-after' => '', // Optional, Dismiss-able notice time. It'll auto show after given time.
+ 'class' => '', // Optional, Additional notice wrapper class.
+ 'priority' => 10, // Priority of the notice.
+ 'display-with-other-notices' => true, // Should the notice be displayed if other notices are being displayed from Astra_Notices.
+ );
+
+ // Count for the notices that are rendered.
+ $notices_displayed = 0;
+
+ // sort the array with priority.
+ usort( self::$notices, array( $this, 'sort_notices' ) );
+
+ foreach ( self::$notices as $key => $notice ) {
+
+ $notice = wp_parse_args( $notice, $defaults );
+
+ $notice['id'] = self::get_notice_id( $notice, $key );
+
+ $notice['classes'] = self::get_wrap_classes( $notice );
+
+ // Notices visible after transient expire.
+ if ( isset( $notice['show_if'] ) && true === $notice['show_if'] ) {
+ if ( self::is_expired( $notice ) ) {
+
+ // don't display the notice if it is not supposed to be displayed with other notices.
+ if ( 0 !== $notices_displayed && false === $notice['display-with-other-notices'] ) {
+ continue;
+ }
+
+ self::markup( $notice );
+ }
+ } else {
+ // No transient notices.
+ self::markup( $notice );
+ }
+
+ ++$notices_displayed;
+ }
+
+ }
+
+ /**
+ * Markup Notice.
+ *
+ * @since 1.4.0
+ * @param array $notice Notice markup.
+ * @return void
+ */
+ public static function markup( $notice = array() ) {
+
+ wp_enqueue_script( 'astra-notices' );
+
+ ?>
+
+ */node_modules/*
*/vendor/*
*/admin/bsf-core/*
+
+
+
+
+
+