PluginProbe
Social Divi / trunk
Social Divi vtrunk
1.7.0 1.8.0 1.8.1 trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0
social-divi / social-divi.php

social-divi.php in Social Divi trunk, at social-divi.php

52 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: Social Divi
5 * Plugin URI: https://github.com/jelleroorda/social-divi
6 * Description: A simple extension on the social icons available in Divi. Requires the <a href="https://wordpress.org/plugins/font-awesome/">Font Awesome plugin</a> to function (for the icons).
7 * Version: 1.8.1
8 * Author: Jelle Roorda
9 * Author URI: https://roordaict.nl
10 * Text Domain: social-divi
11 * Domain Path: /i18n/languages/
12 */
13
14 // Exit if accessed directly.
15 if (!defined('ABSPATH')) {
16 exit;
17 }
18
19 // Define SOCIAL_DIVI_PLUGIN_FILE.
20 if (!defined('SOCIAL_DIVI_PLUGIN_FILE')) {
21 define('SOCIAL_DIVI_PLUGIN_FILE', __FILE__);
22 }
23
24 // Let users know we need the font awesome plugin as a dependency
25 add_action('admin_init', 'social_divi_ensure_font_awesome');
26 function social_divi_ensure_font_awesome()
27 {
28 if (
29 is_admin()
30 && current_user_can('activate_plugins')
31 && !is_plugin_active('font-awesome/font-awesome.php')
32 && !is_plugin_active('font-awesome/index.php')
33 ) {
34 add_action('admin_notices', 'social_divi_display_font_awesome_requirement_error');
35
36 deactivate_plugins(plugin_basename(__FILE__));
37
38 if (isset($_GET['activate'])) {
39 unset($_GET['activate']);
40 }
41 }
42 }
43
44 // Displays a helpful message, to why the plugin wasn't successfully activated.
45 function social_divi_display_font_awesome_requirement_error()
46 {
47 ?><div class="error"><p><?php echo sprintf(esc_html(_x('Social Divi needs the Font Awesome plugin to work properly. Please install and activate %s first.', 'Error message when Font Awesome plugin is missing, %s is the link to Font Awesome plugin.', 'social-divi')), '<a href="' . admin_url('plugin-install.php?s=font+awesome&tab=search&type=term') . '">Font Awesome</a>'); ?></p></div><?php
48 }
49
50 // Bootstrap plugin
51 include_once dirname(__FILE__) . '/src/bootstrap.php';
52