Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/seo-by-rank-math/includes/modules/acf/class-acf.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
/**
3
+
* The ACF Module
4
+
*
5
+
* @since 1.0.33
6
+
* @package RankMath
7
+
* @subpackage RankMath\ACF
8
+
* @author Rank Math <support@rankmath.com>
9
+
*/
10
+
11
+
namespace RankMath\ACF;
12
+
13
+
use RankMath\Helper;
14
+
use RankMath\Admin\Admin_Helper;
15
+
use RankMath\Traits\Hooker;
16
+
17
+
defined( 'ABSPATH' ) || exit;
18
+
19
+
/**
20
+
* ACF class.
21
+
*/
22
+
class ACF {
23
+
use Hooker;
24
+
25
+
/**
26
+
* The Constructor.
27
+
*/
28
+
public function __construct() {
29
+
if ( ! Admin_Helper::is_post_edit() && ! Admin_Helper::is_term_edit() ) {
30
+
return;
31
+
}
32
+
33
+
$this->action( 'rank_math/admin/editor_scripts', 'enqueue' );
34
+
}
35
+
36
+
/**
37
+
* Enqueue styles and scripts for the metabox on the post editor & term editor screens.
38
+
*/
39
+
public function enqueue() {
40
+
if ( Helper::is_elementor_editor() ) {
41
+
return;
42
+
}
43
+
44
+
if ( ! Admin_Helper::is_post_edit() && ! Admin_Helper::is_term_edit() ) {
45
+
return;
46
+
}
47
+
48
+
wp_enqueue_script( 'rank-math-acf-post-analysis', rank_math()->plugin_url() . 'includes/modules/acf/assets/js/acf.js', [ 'wp-hooks', 'rank-math-analyzer' ], rank_math()->version, true );
49
+
50
+
Helper::add_json( 'acf', $this->get_config() );
51
+
}
52
+
53
+
/**
54
+
* Get ACF module config data.
55
+
*
56
+
* @return array The config data.
57
+
*/
58
+
private function get_config() {
59
+
60
+
/**
61
+
* Filter the ACF config data.
62
+
*
63
+
* @param array $config Config data array.
64
+
*/
65
+
return $this->do_filter(
66
+
'acf/config',
67
+
[
68
+
'pluginName' => 'rank-math-acf',
69
+
'headlines' => [],
70
+
'names' => [],
71
+
'refreshRate' => $this->get_refresh_rate(),
72
+
'blacklistTypes' => $this->get_blacklist_type(),
73
+
]
74
+
);
75
+
}
76
+
77
+
/**
78
+
* Retrieves the default blacklist - the field types we won't include in the SEO analysis.
79
+
*
80
+
* @return array The blacklisted field types.
81
+
*/
82
+
private function get_blacklist_type() {
83
+
84
+
/**
85
+
* Filter the blacklisted ACF field types.
86
+
*
87
+
* @param array $blacklist The blacklisted field types.
88
+
*/
89
+
return $this->do_filter(
90
+
'acf/blacklist/types',
91
+
[
92
+
'number',
93
+
'password',
94
+
'file',
95
+
'select',
96
+
'checkbox',
97
+
'radio',
98
+
'true_false',
99
+
'post_object',
100
+
'page_link',
101
+
'relationship',
102
+
'user',
103
+
'date_picker',
104
+
'color_picker',
105
+
'message',
106
+
'tab',
107
+
'repeater',
108
+
'flexible_content',
109
+
'group',
110
+
]
111
+
);
112
+
}
113
+
114
+
/**
115
+
* Get refresh rate to be used.
116
+
*
117
+
* @return int The number of milliseconds between runs.
118
+
*/
119
+
private function get_refresh_rate() {
120
+
121
+
/**
122
+
* Filter the refresh rate for changes to ACF fields.
123
+
*
124
+
* @param int $refresh_rate Refresh rates in milliseconds.
125
+
*/
126
+
$refresh_rate = $this->do_filter( 'acf/refresh_rate', 1000 );
127
+
$refresh_rate = intval( $refresh_rate, 10 );
128
+
129
+
return max( 200, $refresh_rate );
130
+
}
131
+
}
132
+