forked from wallabi-es/image-focus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
image-focus.php
42 lines (34 loc) · 1.25 KB
/
image-focus.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/*
Plugin Name: Image Focus
Plugin URI: https://github.com/wallabi-es/image-focus
Description: Image Focus is an image crop plugin where you can crop your images by focal point.
Version: 0.9.3
Author: Wallabi.es
Author URI: http://www.wallabi.es/
Copyright: Danny van Holten, Harwin Borger
*/
use ImageFocus\ImageFocus;
if (!defined('ABSPATH')) {
exit;
} // Exit if accessed directly
// Define multiple necessary constants
define('IMAGEFOCUS_VERSION', '0.9.2');
define('IMAGEFOCUS_TEXTDOMAIN', 'image-focus');
define('IMAGEFOCUS_LANGUAGES', dirname(plugin_basename(__FILE__)) . '/languages/');
define('IMAGEFOCUS_ASSETS', plugin_dir_url(__FILE__));
define('IMAGEFOCUS_RESOURCES', __DIR__ . '/resources/');
// Use composer to autoload our classes
require_once __DIR__ . '/vendor/autoload.php';
// Initiate the field!
new ImageFocus();
/**
* FIX FOR Wordpress > 5.23
* Restore data attribute with attachment_id for Image Focus plugin.
*/
add_action( 'wp_enqueue_media', 'imagefocus_media_hotfix' );
function imagefocus_media_hotfix() {
if ( is_admin() ) {
wp_add_inline_script( 'media-views', 'wp.media.view.Attachment.Details=wp.media.view.Attachment.Details.extend({attributes:function(){return{"data-id":this.model.get("id")}}});' );
}
}