/
Core.php
78 lines (64 loc) · 1.38 KB
/
Core.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
<?php
namespace ACFQuickEdit\Core;
use ACFQuickEdit\Compat;
if ( ! defined( 'ABSPATH' ) )
die('Nope.');
class Core extends Plugin {
private $post_field_prefix = 'acf_qed_';
/**
* @inheritdoc
*/
protected function __construct() {
add_action( 'plugins_loaded' , array( $this , 'load_textdomain' ) );
add_action( 'plugins_loaded' , array( $this , 'init_compat' ), 0 );
add_action( 'init' , array( $this , 'init' ) );
}
/**
* @return string
*/
public function get_version() {
$version = null;
if ( ! $version = get_option('acf_quickedit_version') ) {
if ( function_exists('get_plugin_data') ) {
$plugin_data = get_plugin_data( ACF_QUICK_EDIT_FILE );
$version = $plugin_data['Version'];
}
}
return $version;
}
/**
* Load frontend styles and scripts
*
* @action wp_enqueue_scripts
*/
function wp_enqueue_style() {
}
/**
* Load text domain
*
* @action plugins_loaded
*/
public function init_compat() {
if ( class_exists( 'Polylang' ) ) {
Compat\Polylang::instance();
}
}
/**
* Load text domain
*
* @action plugins_loaded
*/
public function load_textdomain() {
load_plugin_textdomain( 'acf-quick-edit-fields' , false, ACF_QUICK_EDIT_DIRECTORY . '/languages/' );
}
/**
* Init hook.
*
* @action init
*/
function init() {
}
public function prefix( $str ) {
return $this->post_field_prefix . $str;
}
}