-
Notifications
You must be signed in to change notification settings - Fork 0
/
acf-media-gallery-field.php
62 lines (53 loc) · 1.63 KB
/
acf-media-gallery-field.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/*
Plugin Name: Advanced Custom Fields: Media Gallery Field
Description: Media Gallery field for ACF
Version: 1.0.1
Author: Arman H
Author URI: https://airarm.wordpress.com
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: acf_mgf
*/
if(!defined('ABSPATH')){
exit;
}
if(!class_exists('ACF_Media_Gallery_Field_Init') )
{
class ACF_Media_Gallery_Field_Init
{
var $settings;
public function __construct()
{
$this->settings = array(
'version' => '1.0.0',
'url' => plugin_dir_url(__FILE__),
'path' => plugin_dir_path(__FILE__)
);
add_action('acf/include_field_types', array($this, 'include_field')); // v5
add_action('acf/register_fields', array($this, 'include_field')); // v4
}
function include_field( $version = false )
{
if(!$version){
$version = 4;
}
load_plugin_textdomain('acf_mgf', false, plugin_basename(dirname( __FILE__ )) . '/lang');
if($version == 4)
{
add_action('admin_notices', array($this, 'show_admin_version_notice'));
return;
}
include_once('fields/acf-media-gallery-field-v' . $version . '.php');
}
function show_admin_version_notice()
{
?>
<div class="notice notice-error is-dismissible">
<p><?php _e('Please use ACF plugin version 5 or higher');?></p>
</div>
<?php
}
}
new ACF_Media_Gallery_Field_Init();
}