' . sprintf( __( 'Please %s %s plugin to version %s or higher.', 'jnews' ), $action, $plugin['name'], '9.0.0' ) . ' ' . ucfirst( $action ) . ' Now

'; // phpcs:enable WordPress.WP.I18n.UnorderedPlaceholdersText return $html; } /** * Print plugin update notice * * @param array $plugins List plugins. * * @return string */ public function print_plugin_update_notice( $plugins ) { $all_plugins = get_plugins(); $notice = ''; $required = array( 'jnews-essential' ); foreach ( $plugins as $key => $plugin ) { if ( in_array( $plugin['slug'], $required, true ) ) { // Maybe in the future need to send warning notice if the plugin isn't installed. if ( isset( $plugin['file'] ) && ! empty( $all_plugins[ $plugin['file'] ] ) ) { // Send warning notice to users about the required plugin version in the latest theme version. if ( defined( 'JNEWS_ESSENTIAL' ) ) { $plugin_data = get_plugin_data( JNEWS_ESSENTIAL_FILE ); $plugin_version = $plugin_data['Version']; if ( version_compare( $plugin_version, '9.0.0', '<' ) ) { $notice .= $this->plugin_update_notice_text( $plugin, 'update' ); } } } } } return $notice; } /** * Method preview_init * * @return void */ public function preview_init() { // Theme Customizer Redirect Tag Init. CustomizerRedirect::getInstance(); } /** * Method setup_hook * * @return void */ public function setup_hook() { define( 'YP_THEME_MODE', 'true' ); add_action( 'admin_init', array( $this, 'disable_vc_auto_update' ), 9 ); add_action( 'after_setup_theme', array( $this, 'themes_support' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'load_admin_style' ) ); add_action( 'customize_preview_init', array( $this, 'preview_init' ) ); add_action( 'admin_head', array( $this, 'admin_ajax_url' ), 1 ); add_action( 'after_switch_theme', array( $this, 'flush_rewrite_rules' ) ); add_action( 'admin_notices', array( $this, 'plugin_update_notice' ) ); add_filter( 'jquery_migrate_panel', array( $this, 'migrate_panel' ) ); add_action( 'jnews_update_themes', array( $this, 'update_themes' ) ); } /** * Provide custom schedule update status for themes */ public function update_themes() { AdminDashboard::getInstance(); if ( is_admin() || wp_doing_cron() ) { $validate = ValidateLicense::getInstance(); $transient = get_site_transient( 'update_themes' ); $transient = $validate->transient_update_themes( $transient ); set_site_transient( 'update_themes', $transient ); } } /** * Method themes_support * * @return void */ public function themes_support() { // support feed link. add_theme_support( 'automatic-feed-links' ); // title tag. add_theme_support( 'title-tag' ); // featured image. add_theme_support( 'post-thumbnails' ); // Add support for full and wide align images. add_theme_support( 'align-wide' ); // selective refresh widget. add_theme_support( 'customize-selective-refresh-widgets' ); // Supported post type. add_theme_support( 'post-formats', array( 'gallery', 'video' ) ); // HTML 5 support. add_theme_support( 'html5', array( 'search-form', 'gallery', 'caption' ) ); // support woocommerce. add_theme_support( 'woocommerce' ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); // auto load next post. add_theme_support( 'auto-load-next-post' ); // gutenberg optimized. if ( get_theme_mod( 'jnews_gutenberg_editor_style', true ) ) { // eMAHmTKT. add_theme_support( 'editor-styles' ); add_editor_style( 'style-editor.css' ); } // add excerpt to page to avoid showing shortode on search page. add_post_type_support( 'page', 'excerpt' ); // global variables to avoid duplicate queries. global $jnews_get_all_custom_archive_template; $jnews_get_all_custom_archive_template = jnews_get_all_custom_archive_template(); } }