slug = sanitize_title($translations['product_title']); // Users of the wordpress.org release are required to explicitly opt in $this->require_user_confirmation = ('2' !== $updraftplus->version[0] || !defined('UDADDONS2_DIR')); if ($this->require_user_confirmation && 'no' === get_user_meta(get_current_user_id(), $this->slug.'_confirmed_news_offer', true)) return; parent::__construct($feed_url, $link, $translations); add_action('admin_enqueue_scripts', array($this, 'enqueue_inline_style')); add_action('wp_ajax_'.$this->slug.'_ajax_confirm_news_offer', array($this, 'confirm_news_offer')); } /** * Enqueue news offer cascading style sheet * * @return void */ public function enqueue_inline_style() { global $pagenow; if ('index.php' != $pagenow) return; wp_register_style('updraftplus-news-offer-style', false); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion -- not specifying the URL as we just need an alias name/handle wp_enqueue_style('updraftplus-news-offer-style'); wp_add_inline_style('updraftplus-news-offer-style', $this->news_offer_css_style()); } /** * Get dashboard news HTML based on the installed version while respecting user pre-existing preference * * @return String - the output of the offering message in HTML format */ protected function get_dashboard_news_html() { if ($this->require_user_confirmation) { $confirmed_news_offer = (string) get_user_meta(get_current_user_id(), $this->slug.'_confirmed_news_offer', true); if ('no' === $confirmed_news_offer) return; if (!in_array(strtolower($confirmed_news_offer), array('yes', 'no'))) return '