Check it out and let us know what you think!', 'ml-slider'), self_admin_url('admin.php?page=metagallery'));
// $metaslider_callout_text = sprintf(__('Hey there! We just started working on a brand new gallery extension. Check it out and let us know what you think! Check it out', 'ml-slider'), self_admin_url('admin.php?page=metaslider'), esc_attr($tour_reset));
$metaslider_callout_image = '';
/**
* Also allow users to hide indefinitely
*/
if (defined('METASLIDER_HIDE_CALLOUT') && METASLIDER_HIDE_CALLOUT) {
return;
}
new MetaSlider_Callout($metaslider_callout_name, $metaslider_callout_text, $metaslider_callout_image);
/**
* Class to handle a callout
*/
class MetaSlider_Callout
{
/**
* The notice key
*
* @var string
*/
protected $key;
/**
* The notice text
*
* @var string
*/
protected $text;
/**
* The image html
*
* @var string
*/
protected $image;
/**
* The page to show it on
* get_current_screen()->id
*
* @var string
*/
protected $page;
/**
* Constructor
*
* @param string $key The key of the callout (should be unique)
* @param string $text The text of the callout
* @param string|null $image The html of the image
* @param string $page The page to show the callout
*/
public function __construct($key, $text, $image = null, $page = 'plugins')
{
$this->key = $key;
$this->text = $text;
$this->page = $page;
// Default to the MetaSlider logo
$this->image = $image ? $image : "";
// Load the scripts and initialize
add_action('admin_enqueue_scripts', array($this, 'setup_callout'));
}
/**
* Method to load in call out scripts
*/
public function setup_callout()
{
// Only show to users who can access MetaSlider
$capability = apply_filters('metaslider_capability', MetaSliderPlugin::DEFAULT_CAPABILITY_EDIT_SLIDES);
if (!current_user_can($capability)) {
return;
}
// Only show on the specified page
if ($this->page !== get_current_screen()->id) {
return;
}
// Only show once
if ((bool) get_user_option('metaslider_user_saw_callout_' . $this->key)) {
return;
}
update_user_option(get_current_user_id(), 'metaslider_user_saw_callout_' . $this->key, true);
// Add all the necessary scripts and styles
wp_enqueue_script('metaslider-tether-js-callout', METASLIDER_ADMIN_URL . 'assets/tether/dist/js/tether.min.js', METASLIDER_ASSETS_VERSION, true);
wp_enqueue_script('metaslider-shepherd-js-callout', METASLIDER_ADMIN_URL . 'assets/tether-shepherd/dist/js/shepherd.min.js', array('metaslider-tether-js-callout'), METASLIDER_ASSETS_VERSION, true);
$this->wp_add_inline_script('metaslider-shepherd-js-callout', "
try {
window.jQuery(function($) {
var ms_callout_tour = new Shepherd.Tour();
ms_callout_tour.options.defaults = {
classes: 'shepherd-theme-arrows metaslider-callout-tip',
showCancelLink: true,
tetherOptions: {
offset: '0 5px'
}
};
ms_callout_tour.addStep('welcome', {
title: 'Check out what\'s new!',
text: '