| 1 |
<?php |
| 2 |
/* |
| 3 |
@package DrawAttention |
| 4 |
@author N Squared <support@wpdrawattention.com> |
| 5 |
@license GPL-2.0+ |
| 6 |
@link https://wpdrawattention.com |
| 7 |
@copyright 2024 NSquared |
| 8 |
@wordpress-plugin |
| 9 |
Plugin Name: Draw Attention |
| 10 |
Plugin URI: https://wpdrawattention.com |
| 11 |
Description: Create interactive images in WordPress |
| 12 |
Version: 2.1.9 |
| 13 |
Author: NSquared |
| 14 |
Author URI: https://nsquared.io |
| 15 |
Text Domain: draw-attention |
| 16 |
License: GPL-2.0+ |
| 17 |
License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 18 |
Domain Path: /languages |
| 19 |
GitHub Plugin URI: https://github.com/tylerdigital/draw-attention |
| 20 |
*/ |
| 21 |
|
| 22 |
// If this file is called directly, abort. |
| 23 |
if ( ! defined( 'WPINC' ) ) { |
| 24 |
die; |
| 25 |
} |
| 26 |
|
| 27 |
/* |
| 28 |
----------------------------------------------------------------------------* |
| 29 |
* Public-Facing Functionality |
| 30 |
*----------------------------------------------------------------------------*/ |
| 31 |
|
| 32 |
/* |
| 33 |
* @TODO: |
| 34 |
* |
| 35 |
* - replace `class-drawattention.php` with the name of the plugin's class file |
| 36 |
* |
| 37 |
*/ |
| 38 |
require_once plugin_dir_path( __FILE__ ) . 'public/class-drawattention.php'; |
| 39 |
|
| 40 |
/* |
| 41 |
* Register hooks that are fired when the plugin is activated or deactivated. |
| 42 |
* When the plugin is deleted, the uninstall.php file is loaded. |
| 43 |
* |
| 44 |
* @TODO: |
| 45 |
* |
| 46 |
* - replace DrawAttention with the name of the class defined in |
| 47 |
* `class-drawattention.php` |
| 48 |
*/ |
| 49 |
register_activation_hook( __FILE__, array( 'DrawAttention', 'activate' ) ); |
| 50 |
register_deactivation_hook( __FILE__, array( 'DrawAttention', 'deactivate' ) ); |
| 51 |
|
| 52 |
/* |
| 53 |
* @TODO: |
| 54 |
* |
| 55 |
* - replace DrawAttention with the name of the class defined in |
| 56 |
* `class-drawattention.php` |
| 57 |
*/ |
| 58 |
add_action( 'plugins_loaded', array( 'DrawAttention', 'get_instance' ) ); |
| 59 |
|
| 60 |
/* |
| 61 |
----------------------------------------------------------------------------* |
| 62 |
* Dashboard and Administrative Functionality |
| 63 |
*----------------------------------------------------------------------------*/ |
| 64 |
|
| 65 |
/* |
| 66 |
* @TODO: |
| 67 |
* |
| 68 |
* - replace `class-drawattention-admin.php` with the name of the plugin's admin file |
| 69 |
* - replace DrawAttention_Admin with the name of the class defined in |
| 70 |
* `class-drawattention-admin.php` |
| 71 |
* |
| 72 |
* If you want to include Ajax within the dashboard, change the following |
| 73 |
* conditional to: |
| 74 |
* |
| 75 |
* if ( is_admin() ) { |
| 76 |
* ... |
| 77 |
* } |
| 78 |
* |
| 79 |
* The code below is intended to to give the lightest footprint possible. |
| 80 |
*/ |
| 81 |
if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { |
| 82 |
|
| 83 |
require_once plugin_dir_path( __FILE__ ) . 'admin/class-drawattention-admin.php'; |
| 84 |
add_action( 'plugins_loaded', array( 'DrawAttention_Admin', 'get_instance' ) ); |
| 85 |
|
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
/** |
| 91 |
* Responsive Image Maps plugin attempts to take over any image map on the page, which interferes with our plugin’s ability to resize and place hotspots correctly. |
| 92 |
* Please check your list of active plugins to see if you have the Responsive Image Maps plugin installed and activated. If so, we regretfully recommend deactivating this plugin. |
| 93 |
* It has been abandoned and has not been updated since 2015. |
| 94 |
* Here is a link to our public ticket asking the plugin author to update their plugin: https://wordpress.org/support/topic/conflict-with-draw-attention-plugin-2/ |
| 95 |
* |
| 96 |
* Our final solution is to dequeue the Responsive Image Maps plugin’s script if it is active. |
| 97 |
* And tell WordPress to not load RIM plugin |
| 98 |
*/ |
| 99 |
function da_dequeue_conflicting_rim_scripts() { |
| 100 |
|
| 101 |
if ( ! function_exists( 'pn_rim_enqueue_scripts' ) ) { |
| 102 |
return; |
| 103 |
} |
| 104 |
|
| 105 |
wp_dequeue_script( 'jQuery.rwd_image_maps' ); |
| 106 |
} |
| 107 |
|
| 108 |
function da_disable_rim_plugin() { |
| 109 |
|
| 110 |
if ( ! function_exists( 'pn_rim_enqueue_scripts' ) ) { |
| 111 |
return; |
| 112 |
} |
| 113 |
|
| 114 |
remove_action( 'wp_head', 'pn_rim_header_scripts' ); |
| 115 |
} |
| 116 |
|
| 117 |
function da_dequeue_conflicting_mapit_scripts() { |
| 118 |
if ( get_post_type() != 'da_image' ) { |
| 119 |
return; |
| 120 |
} |
| 121 |
|
| 122 |
if ( ! function_exists( 'wp_mapit_init' ) ) { |
| 123 |
return; |
| 124 |
} |
| 125 |
|
| 126 |
wp_dequeue_script( 'wp-mapit-leaflet-js' ); |
| 127 |
} |
| 128 |
|
| 129 |
add_action( 'init', 'da_disable_rim_plugin' ); |
| 130 |
add_action( 'wp_enqueue_scripts', 'da_dequeue_conflicting_rim_scripts', 999 ); |
| 131 |
add_action( 'admin_enqueue_scripts', 'da_dequeue_conflicting_mapit_scripts', 999 ); |
| 132 |
|