admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('twae_upgrade_notice_nonce'),
]
);
});
function twe_enqueue_style() {
wp_enqueue_style( 'twe-preview', TWE_PLUGIN_URL . 'assets/css/style.css', array());
}
class TweTimelinePlugin {
private static $instance = null;
public static function get_instance() {
if ( ! self::$instance )
self::$instance = new self;
return self::$instance;
}
public function init(){
add_action( 'elementor/widgets/widgets_registered', array( $this, 'widgets_registered' ) );
}
public function widgets_registered() {
if ( defined('ELEMENTOR_PATH') && class_exists('Elementor\Widget_Base') ) {
$template_file = plugin_dir_path(__FILE__) . 'timeline-widget.php';
if ( is_readable($template_file) ) {
require_once $template_file;
}
}
}
}
TweTimelinePlugin::get_instance()->init();
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'twe_add_pro_link' );
function twe_add_pro_link( $links ) {
$links[] = 'Get Pro';
return $links;
}
add_filter( 'plugin_row_meta', 'twe_add_view_demo_row_meta', 10, 2 );
function twe_add_view_demo_row_meta( $links, $file ) {
if ( $file === plugin_basename( __FILE__ ) ) {
$demo_link = 'View Demo';
array_splice( $links, count( $links ), 0, $demo_link );
}
return $links;
}
/**
* AJAX: Hide Upgrade Notice
*/
add_action( 'wp_ajax_twae_hide_upgrade_notice_editor', 'twae_hide_upgrade_notice_editor_callback' );
function twae_hide_upgrade_notice_editor_callback() {
check_ajax_referer( 'twae_upgrade_notice_nonce', 'security' );
update_option( 'twae_hide_upgrade_notice_editor', 'yes' );
wp_send_json_success([
'message' => 'Upgrade notice dismissed'
]);
}