id, array('plugins', 'dashboard')) ) { return; } $plugin_dir = WP_PLUGIN_DIR . '/franklin/franklin.php'; $img = get_template_directory_uri() . '/assets/admin/img/banner-772x250.jpg'; if(!is_readable($plugin_dir)) { $btn_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=franklin'), 'install-plugin_franklin'); $btn_text = 'Install Now'; } else { $btn_url = admin_url('plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s'); $btn_url = wp_nonce_url($btn_url, 'activate-plugin_' . $plugin); $btn_text = 'Activate'; } $output .= '
'; if($dismissable == 'dismissable') { $output .= ''; $output .= ' Dismiss '; $output .= ''; } $output .= '
'; $output .= '

'; $output .= esc_html__('Introducing Franklin', 'benjamin'); // WPCS: xss ok. $output .= '

'; $output .= '
A companion plugin to the Benjamin theme
'; $output .= '

'; $output .= esc_html__('Franklin enhances the Benjamin theme with frequent updates, and adds additonal features like:', 'benjamin'); // WPCS: xss ok. $output .= '

'; $output .= ''; $output .= '

'; $output .= ''; $output .= esc_html__('Click here', 'benjamin'); $output .= ''; $output .= esc_html__(' to learn more, or install and activate now.','benjamin'); $output .= '

'; $output .= ''; $output .= sprintf( // translators: Either "install Now or Activate. See lines 46 and 51" esc_html(__('%s ', 'benjamin')), esc_html($btn_text) ); $output .= ''; if($dismissable == 'dismissable') { $output .= ''; $output .= __('Don\'t show this again', 'benjamin'); $output .= ''; } $output .= '
'; $output .= '
'; return $output; } // get the markup for the franklin advert function benjamin_franklin_advert($dismissable = 'not-dismissable') { echo benjamin_get_franklin_advert($dismissable); // WPCS: xss ok. } /** * [benjamin_franklin_notice description] * @return [type] [description] */ function benjamin_franklin_notice(){ $option = get_option('benjamin-franklin-notice', false); $screen = get_current_screen(); if( $option == 'dismissed' || !in_array($screen->id, array('plugins', 'dashboard')) ) { return; } benjamin_franklin_advert('dismissable'); } add_action( 'admin_notices', 'benjamin_franklin_notice' );