functions.php
61 lines
| 1 | <?php |
| 2 | // Exit if accessed directly |
| 3 | defined('ABSPATH') || exit; |
| 4 | |
| 5 | if (! function_exists('amelia_installed_plugins_wpdt_promotion')) : |
| 6 | function amelia_installed_plugins_wpdt_promotion() |
| 7 | { |
| 8 | $plugins_to_check = array( |
| 9 | 'visualizer/index.php', |
| 10 | 'tablepress/tablepress.php', |
| 11 | 'ninja-tables/ninja-tables.php', |
| 12 | 'wp-table-builder/wp-table-builder.php', |
| 13 | 'wp-table-manager/wp-table-manager.php', |
| 14 | 'data-tables-generator-by-supsystic/index.php', |
| 15 | 'superb-tables/superb-tables.php', |
| 16 | 'tablesome/tablesome.php', |
| 17 | 'tableberg/tableberg.php' |
| 18 | ); |
| 19 | |
| 20 | $installed_plugins = array(); |
| 21 | $installed_plugins_not_active = array(); |
| 22 | |
| 23 | foreach ($plugins_to_check as $plugin) { |
| 24 | if (is_plugin_active($plugin)) { |
| 25 | $installed_plugins[] = $plugin; |
| 26 | } |
| 27 | if(wpAmelia_is_plugin_installed($plugin)){ |
| 28 | $installed_plugins_not_active[] = $plugin; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | if (!empty($installed_plugins)) { |
| 33 | if(!is_plugin_inactive('wpdatatables/wpdatatables.php') && |
| 34 | is_plugin_inactive('wpdatatables/wpdatatables.php')) { |
| 35 | return true; |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | if (!empty($installed_plugins_not_active)) { |
| 40 | if(!wpAmelia_is_plugin_installed('wpdatatables/wpdatatables.php')) { |
| 41 | return true; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | return false; |
| 46 | } |
| 47 | |
| 48 | function wpAmelia_is_plugin_installed($plugin_path) { |
| 49 | $plugins_dir = WP_PLUGIN_DIR; |
| 50 | $plugin_file = $plugins_dir . '/' . $plugin_path; |
| 51 | |
| 52 | if (file_exists($plugin_file)) { |
| 53 | return true; |
| 54 | } else { |
| 55 | return false; |
| 56 | } |
| 57 | } |
| 58 | endif; |
| 59 | |
| 60 | ?> |
| 61 |