-
Notifications
You must be signed in to change notification settings - Fork 4
/
acf-oembed.php
executable file
·82 lines (65 loc) · 1.43 KB
/
acf-oembed.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/*
Plugin Name: Advanced Custom Fields: oEmbed Field
Plugin URI: https://github.com/dmsqd/acf-oembed-field
Description: Adds a oEmbed field type to Advanced Custom Fields
Version: 1.0.3
Author: DMSQD
Author URI: http://dmsqd.com
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
class acf_field_oembed_plugin
{
/*
* Construct
*
* @description:
* @since: 3.6
* @created: 1/04/13
*/
function __construct()
{
// set text domain
/*
$domain = 'acf-oembed';
$mofile = trailingslashit(dirname(__File__)) . 'lang/' . $domain . '-' . get_locale() . '.mo';
load_textdomain( $domain, $mofile );
*/
// version 4+
add_action('acf/register_fields', array($this, 'register_fields'));
// version 3-
add_action('init', array( $this, 'init' ), 5);
//register ajax handler
require_once(dirname(__FILE__) . '/oembed-ajax.php' );
add_action( 'wp_ajax_acf_oembed_handler', array( 'acf_oembed_ajax', 'oembed_handler' ) );
}
/*
* Init
*
* @description:
* @since: 3.6
* @created: 1/04/13
*/
// TODO: support v3 later
function init()
{
if(function_exists('register_field'))
{
// register_field('acf_field_oembed', dirname(__File__) . '/oembed-v3.php');
}
}
/*
* register_fields
*
* @description:
* @since: 3.6
* @created: 1/04/13
*/
function register_fields()
{
include_once(dirname(__FILE__) . '/oembed-v4.php');
}
}
new acf_field_oembed_plugin();
?>