Skip to content

Commit 669445d

Browse files
added dashboard banner widget
1 parent 2797916 commit 669445d

File tree

6 files changed

+70
-17
lines changed

6 files changed

+70
-17
lines changed

animation-addons-for-elementor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Animation Addons
44
* Description: Animation Addons for Elementor comes with GSAP Animation Builder, Customizable Widgets, Header Footer, Single Post, Archive Page Builder, and more.
55
* Plugin URI: https://animation-addons.com/
6-
* Version: 2.4.0
6+
* Version: 2.4.1
77
* Author: Wealcoder
88
* Author URI: https://animation-addons.com/
99
* License: GPL v2 or later

assets/images/halloween-widget.png

282 KB
Loading

inc/admin/Notices/Notices.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ public function __construct() {
5353

5454
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
5555
add_action( 'admin_init', array( $this, 'add_admin_notices' ) );
56+
5657

5758
$this->plugin_prefix = 'aae_notice_';
5859
add_action( 'wp_ajax_' . $this->plugin_prefix . '_dismiss_notice', array( $this, 'ajax_dismiss_notice' ) );
59-
60+
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
6061
}
6162

6263
/**
@@ -79,8 +80,8 @@ public function enqueue_scripts() {
7980
public function add_admin_notices() {
8081
$installed_time = absint( get_option( 'aae_installed' ) );
8182
$current_time = absint( wp_date( 'U' ) );
82-
83-
if ( ! defined( 'WCF_ADDONS_PRO_VERSION' ) && $current_time > ( $installed_time + ( DAY_IN_SECONDS ) ) ) {
83+
$plugin_file = WP_PLUGIN_DIR . '/animation-addons-for-elementor-pro/animation-addons-for-elementor-pro.php';
84+
if ( !file_exists( $plugin_file ) ) {
8485
wp_enqueue_style( 'aae-notice-halloween' );
8586
$this->add(
8687
array(
@@ -91,18 +92,7 @@ public function add_admin_notices() {
9192
)
9293
);
9394
}
94-
95-
// Show after 5 days.
96-
if ( $installed_time && $current_time < ( $installed_time + ( 5 * DAY_IN_SECONDS ) ) ) {
97-
$this->add(
98-
array(
99-
'message' => __DIR__ . '/views/review.php',
100-
'dismissible' => false,
101-
'notice_id' => 'aae_review',
102-
'style' => 'border-left-color: #FC6848; border-radius: 6px; overflow: hidden;',
103-
)
104-
);
105-
}
95+
10696
}
10797

10898
/**

inc/admin/banner/ads.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<div class="aae-dashboard-banner" style="text-align:center;">
2+
<a href="https://animation-addons.com" target="_blank" style="display:block;">
3+
<img src="<?php echo esc_url( WCF_ADDONS_URL ) ; ?>assets/images/halloween-widget.png"
4+
alt="Animation Addons Banner"
5+
style="max-width:100%;">
6+
</a>
7+
8+
<div style="margin-top:10px;display:flex;justify-content:center;gap:15px;font-size:14px;">
9+
<a href="https://animation-addons.com/docs/" target="_blank" style="text-decoration:none;color:#0073aa;">
10+
📘 Docs
11+
</a>
12+
<a href="https://animation-addons.com/blog/" target="_blank" style="text-decoration:none;color:#0073aa;">
13+
📰 Blog
14+
</a>
15+
<a href="https://www.facebook.com/groups/animationaddons" target="_blank" style="text-decoration:none;color:#0073aa;">
16+
💬 Facebook Community
17+
</a>
18+
</div>
19+
</div>

inc/admin/dashboard.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,51 @@ public function init()
108108
add_action('elementor/core/files/clear_cache', function () {
109109
delete_transient('wcf_menu_42_data');
110110
});
111+
112+
add_action( 'wp_dashboard_setup' , [$this , 'dashboard_widget'], 999 );
113+
}
114+
115+
public function dashboard_widget(){
116+
117+
$plugin_file = WP_PLUGIN_DIR . '/animation-addons-for-elementor-pro/animation-addons-for-elementor-pro.php';
118+
if ( file_exists( $plugin_file ) ) {
119+
return;
120+
}
121+
122+
wp_add_dashboard_widget(
123+
'aae_dashboard_widget',
124+
'Animation Addons Overview',
125+
[$this , 'aae_render_dashboard_widget']
126+
);
127+
128+
129+
global $wp_meta_boxes;
130+
131+
// Check that our widget actually exists before reordering
132+
if (isset($wp_meta_boxes['dashboard']['normal']['core']['aae_dashboard_banner'])) {
133+
// Get current dashboard widgets
134+
$normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
135+
136+
// Backup our widget
137+
$aae_widget_backup = [
138+
'aae_dashboard_banner' => $normal_dashboard['aae_dashboard_banner']
139+
];
140+
141+
// Remove from bottom and merge on top
142+
unset($normal_dashboard['aae_dashboard_banner']);
143+
$sorted_dashboard = array_merge($aae_widget_backup, $normal_dashboard);
144+
145+
// Assign back
146+
$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
147+
}
111148
}
149+
150+
function aae_render_dashboard_widget() {
151+
$view = __DIR__ . '/banner/ads.php';
152+
require_once $view;
153+
}
154+
155+
112156
/**
113157
* Summary of elementor_disabled_elements
114158
*

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: Elementor, Elementor Addons, Elementor Templates, Animation, Templates
55
Requires at least: 6.6
66
Tested up to: 6.8
77
Requires PHP: 7.4
8-
Stable tag: 2.4.0
8+
Stable tag: 2.4.1
99
License: GPL v2 or later
1010
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1111

0 commit comments

Comments
 (0)