Version Description
Released January 22nd, 2019
Bugfixes:
- Fixes a bug where textarea and non-headline text content would not be wrapped in paragraphs for the analysis. Props skaeser.
Enhancements:
- Introduces the 'yoast-acf-analysis/field_order' filter which allows for adjusting the ACF field order. This also adds the possibility to prepend field content to WordPress' post_content using a negative field order. Props skaeser.
Download this release
Release Info
Developer | Yoast |
Plugin | ACF Content Analysis for Yoast SEO |
Version | 2.2.0 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.2.0
- .phpcs.xml.dist +120 -0
- inc/ac-yoast-seo-acf-content-analysis.php +16 -6
- inc/assets.php +0 -1
- inc/configuration/configuration.php +36 -1
- inc/configuration/string-store.php +4 -7
- inc/dependencies/dependency-acf.php +0 -1
- inc/dependencies/dependency-interface.php +1 -0
- inc/dependencies/dependency-yoast-seo.php +0 -1
- inc/registry.php +0 -1
- inc/requirements.php +0 -1
- js/src/collect/collect.js +19 -1
- js/src/scraper-store.js +1 -1
- js/src/scraper/scraper.text.js +2 -0
- js/src/scraper/scraper.textarea.js +1 -1
- js/yoast-acf-analysis.js +24 -4
- readme.txt +15 -3
- tests/js/system/data/test-data-loader-functions.php +0 -1
- tests/php/phpunit.xml.dist +1 -1
- tests/php/unit/Configuration/configuration-test.php +80 -4
- tests/php/unit/Configuration/string-store-test.php +51 -11
- tests/php/unit/Dependencies/acf-dependency-test.php +25 -2
- tests/php/unit/Dependencies/yoast-seo-dependency-test.php +47 -3
- tests/php/unit/Doubles/failing-dependency.php +5 -1
- tests/php/unit/Doubles/passing-dependency.php +5 -1
- tests/php/unit/assets-test.php +27 -3
- tests/php/unit/main-test.php +14 -3
- tests/php/unit/registry-test.php +15 -4
- tests/php/unit/requirements-test.php +25 -3
- vendor/autoload.php +1 -1
- vendor/autoload_52.php +1 -1
- vendor/composer/ClassLoader.php +2 -2
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_real_52.php +3 -3
- vendor/composer/autoload_static.php +5 -5
- yoast-acf-analysis.php +13 -10
.phpcs.xml.dist
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
3 |
+
name="Yoast SEO ACF Analysis"
|
4 |
+
xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd">
|
5 |
+
|
6 |
+
<description>Yoast SEO ACF Analysis Coding Standards</description>
|
7 |
+
|
8 |
+
<!--
|
9 |
+
#############################################################################
|
10 |
+
COMMAND LINE ARGUMENTS
|
11 |
+
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
|
12 |
+
#############################################################################
|
13 |
+
-->
|
14 |
+
|
15 |
+
<file>.</file>
|
16 |
+
|
17 |
+
<exclude-pattern>vendor/*</exclude-pattern>
|
18 |
+
<exclude-pattern>node_modules/*</exclude-pattern>
|
19 |
+
<exclude-pattern>languages/*</exclude-pattern>
|
20 |
+
<exclude-pattern>tests/js/system/data/acf*\.php$</exclude-pattern><!-- Code exported from ACF. -->
|
21 |
+
<exclude-pattern>tests/php/unit/Dependencies/acf\.php$</exclude-pattern><!-- ACF mock class. -->
|
22 |
+
|
23 |
+
<!-- Only check PHP files. -->
|
24 |
+
<arg name="extensions" value="php"/>
|
25 |
+
|
26 |
+
<!-- Show progress, show the error codes for each message (source). -->
|
27 |
+
<arg value="ps"/>
|
28 |
+
|
29 |
+
<!-- Strip the filepaths down to the relevant bit. -->
|
30 |
+
<arg name="basepath" value="./"/>
|
31 |
+
|
32 |
+
<!-- Check up to 8 files simultanously. -->
|
33 |
+
<arg name="parallel" value="8"/>
|
34 |
+
|
35 |
+
|
36 |
+
<!--
|
37 |
+
#############################################################################
|
38 |
+
USE THE YoastCS RULESET
|
39 |
+
#############################################################################
|
40 |
+
-->
|
41 |
+
|
42 |
+
<rule ref="Yoast"/>
|
43 |
+
|
44 |
+
|
45 |
+
<!--
|
46 |
+
#############################################################################
|
47 |
+
SNIFF SPECIFIC CONFIGURATION
|
48 |
+
#############################################################################
|
49 |
+
-->
|
50 |
+
|
51 |
+
<!-- Set the minimum supported WP version. This is used by several sniffs. -->
|
52 |
+
<config name="minimum_supported_wp_version" value="4.6"/>
|
53 |
+
|
54 |
+
<!-- Verify that all gettext calls use the correct text domain. -->
|
55 |
+
<rule ref="WordPress.WP.I18n">
|
56 |
+
<properties>
|
57 |
+
<property name="text_domain" type="array">
|
58 |
+
<element value="acf-content-analysis-for-yoast-seo"/>
|
59 |
+
</property>
|
60 |
+
</properties>
|
61 |
+
</rule>
|
62 |
+
|
63 |
+
<rule ref="Yoast.Files.FileName">
|
64 |
+
<properties>
|
65 |
+
<!-- Don't trigger on the main file as renaming it would deactivate the plugin. -->
|
66 |
+
<property name="exclude" type="array">
|
67 |
+
<element value="yoast-acf-analysis.php"/>
|
68 |
+
</property>
|
69 |
+
|
70 |
+
<!-- Remove the following prefixes from the names of object structures. -->
|
71 |
+
<property name="prefixes" type="array">
|
72 |
+
<element value="Yoast_ACF_Analysis"/>
|
73 |
+
</property>
|
74 |
+
</properties>
|
75 |
+
</rule>
|
76 |
+
|
77 |
+
<!-- Verify that everything in the global namespace is prefixed with a plugin specific prefix. -->
|
78 |
+
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
|
79 |
+
<properties>
|
80 |
+
<!-- Provide the prefixes to look for. -->
|
81 |
+
<property name="prefixes" type="array">
|
82 |
+
<element value="Yoast_ACF"/>
|
83 |
+
<element value="AC_Yoast"/>
|
84 |
+
<element value="AC_SEO"/>
|
85 |
+
<element value="ysacf"/>
|
86 |
+
</property>
|
87 |
+
</properties>
|
88 |
+
</rule>
|
89 |
+
|
90 |
+
<!-- Allow additional word delimiters for hook names. -->
|
91 |
+
<rule ref="WordPress.NamingConventions.ValidHookName">
|
92 |
+
<properties>
|
93 |
+
<property name="additionalWordDelimiters" value="/"/>
|
94 |
+
</properties>
|
95 |
+
</rule>
|
96 |
+
|
97 |
+
<!-- Whitelist a few non-snakecase PHPUnit properties. -->
|
98 |
+
<rule ref="WordPress.NamingConventions.ValidVariableName">
|
99 |
+
<properties>
|
100 |
+
<property name="customPropertiesWhitelist" type="array">
|
101 |
+
<element value="preserveGlobalState"/>
|
102 |
+
<element value="runTestInSeparateProcess"/>
|
103 |
+
</property>
|
104 |
+
</properties>
|
105 |
+
</rule>
|
106 |
+
|
107 |
+
|
108 |
+
<!--
|
109 |
+
#############################################################################
|
110 |
+
SELECTIVE EXCLUSIONS
|
111 |
+
Exclude specific files for specific sniffs and/or exclude sub-groups in sniffs.
|
112 |
+
#############################################################################
|
113 |
+
-->
|
114 |
+
|
115 |
+
<!-- Valid exemption: namespaced files do not need a file docblock in the Yoast repos. -->
|
116 |
+
<rule ref="Squiz.Commenting.FileComment.Missing">
|
117 |
+
<exclude-pattern>/tests/php/unit/*\.php$</exclude-pattern>
|
118 |
+
</rule>
|
119 |
+
|
120 |
+
</ruleset>
|
inc/ac-yoast-seo-acf-content-analysis.php
CHANGED
@@ -14,13 +14,17 @@ class AC_Yoast_SEO_ACF_Content_Analysis {
|
|
14 |
* Yoast_ACF_Analysis init.
|
15 |
*
|
16 |
* Add hooks and filters.
|
|
|
|
|
17 |
*/
|
18 |
public function init() {
|
19 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
20 |
}
|
21 |
|
22 |
/**
|
23 |
-
* Check if all requirements are met and boot plugin if so
|
|
|
|
|
24 |
*/
|
25 |
public function admin_init() {
|
26 |
$dependencies = new Yoast_ACF_Analysis_Requirements();
|
@@ -41,6 +45,8 @@ class AC_Yoast_SEO_ACF_Content_Analysis {
|
|
41 |
|
42 |
/**
|
43 |
* Boots the plugin.
|
|
|
|
|
44 |
*/
|
45 |
public function boot() {
|
46 |
$registry = Yoast_ACF_Analysis_Facade::get_registry();
|
@@ -79,6 +85,8 @@ class AC_Yoast_SEO_ACF_Content_Analysis {
|
|
79 |
|
80 |
/**
|
81 |
* Filters the Scraper Configuration to add the headlines configuration for the text scraper.
|
|
|
|
|
82 |
*/
|
83 |
protected function register_config_filters() {
|
84 |
add_filter(
|
@@ -90,9 +98,9 @@ class AC_Yoast_SEO_ACF_Content_Analysis {
|
|
90 |
/**
|
91 |
* Enhances the scraper config with headlines configuration.
|
92 |
*
|
93 |
-
* @param array $scraper_config
|
94 |
*
|
95 |
-
* @return array
|
96 |
*/
|
97 |
public function filter_scraper_config( $scraper_config ) {
|
98 |
$scraper_config['text'] = array(
|
@@ -124,7 +132,7 @@ class AC_Yoast_SEO_ACF_Content_Analysis {
|
|
124 |
/**
|
125 |
* Retrieves the default field selectors for ACF4.
|
126 |
*
|
127 |
-
* @return Yoast_ACF_Analysis_String_Store
|
128 |
*/
|
129 |
protected function get_field_selectors() {
|
130 |
$field_selectors = new Yoast_ACF_Analysis_String_Store();
|
@@ -162,7 +170,7 @@ class AC_Yoast_SEO_ACF_Content_Analysis {
|
|
162 |
/**
|
163 |
* Retrieves the default blacklist.
|
164 |
*
|
165 |
-
* @return Yoast_ACF_Analysis_String_Store
|
166 |
*/
|
167 |
protected function get_blacklist_type() {
|
168 |
|
@@ -215,7 +223,9 @@ class AC_Yoast_SEO_ACF_Content_Analysis {
|
|
215 |
}
|
216 |
|
217 |
/**
|
218 |
-
*
|
|
|
|
|
219 |
*/
|
220 |
protected function get_blacklist_name() {
|
221 |
return new Yoast_ACF_Analysis_String_Store();
|
14 |
* Yoast_ACF_Analysis init.
|
15 |
*
|
16 |
* Add hooks and filters.
|
17 |
+
*
|
18 |
+
* @return void
|
19 |
*/
|
20 |
public function init() {
|
21 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
22 |
}
|
23 |
|
24 |
/**
|
25 |
+
* Check if all requirements are met and boot plugin if so.
|
26 |
+
*
|
27 |
+
* @return void
|
28 |
*/
|
29 |
public function admin_init() {
|
30 |
$dependencies = new Yoast_ACF_Analysis_Requirements();
|
45 |
|
46 |
/**
|
47 |
* Boots the plugin.
|
48 |
+
*
|
49 |
+
* @return void
|
50 |
*/
|
51 |
public function boot() {
|
52 |
$registry = Yoast_ACF_Analysis_Facade::get_registry();
|
85 |
|
86 |
/**
|
87 |
* Filters the Scraper Configuration to add the headlines configuration for the text scraper.
|
88 |
+
*
|
89 |
+
* @return void
|
90 |
*/
|
91 |
protected function register_config_filters() {
|
92 |
add_filter(
|
98 |
/**
|
99 |
* Enhances the scraper config with headlines configuration.
|
100 |
*
|
101 |
+
* @param array $scraper_config The scraper configuration.
|
102 |
*
|
103 |
+
* @return array The enhanched scraper config.
|
104 |
*/
|
105 |
public function filter_scraper_config( $scraper_config ) {
|
106 |
$scraper_config['text'] = array(
|
132 |
/**
|
133 |
* Retrieves the default field selectors for ACF4.
|
134 |
*
|
135 |
+
* @return Yoast_ACF_Analysis_String_Store The blacklist string store.
|
136 |
*/
|
137 |
protected function get_field_selectors() {
|
138 |
$field_selectors = new Yoast_ACF_Analysis_String_Store();
|
170 |
/**
|
171 |
* Retrieves the default blacklist.
|
172 |
*
|
173 |
+
* @return Yoast_ACF_Analysis_String_Store The blacklist string store.
|
174 |
*/
|
175 |
protected function get_blacklist_type() {
|
176 |
|
223 |
}
|
224 |
|
225 |
/**
|
226 |
+
* Gets a new string store.
|
227 |
+
*
|
228 |
+
* @return Yoast_ACF_Analysis_String_Store A new blacklist string store.
|
229 |
*/
|
230 |
protected function get_blacklist_name() {
|
231 |
return new Yoast_ACF_Analysis_String_Store();
|
inc/assets.php
CHANGED
@@ -65,5 +65,4 @@ class Yoast_ACF_Analysis_Assets {
|
|
65 |
wp_localize_script( 'yoast-acf-analysis-term', 'YoastACFAnalysisConfig', $config->to_array() );
|
66 |
}
|
67 |
}
|
68 |
-
|
69 |
}
|
65 |
wp_localize_script( 'yoast-acf-analysis-term', 'YoastACFAnalysisConfig', $config->to_array() );
|
66 |
}
|
67 |
}
|
|
|
68 |
}
|
inc/configuration/configuration.php
CHANGED
@@ -11,16 +11,22 @@
|
|
11 |
class Yoast_ACF_Analysis_Configuration {
|
12 |
|
13 |
/**
|
|
|
|
|
14 |
* @var Yoast_ACF_Analysis_String_Store
|
15 |
*/
|
16 |
protected $blacklist_type;
|
17 |
|
18 |
/**
|
|
|
|
|
19 |
* @var Yoast_ACF_Analysis_String_Store
|
20 |
*/
|
21 |
protected $blacklist_name;
|
22 |
|
23 |
/**
|
|
|
|
|
24 |
* @var Yoast_ACF_Analysis_String_Store
|
25 |
*/
|
26 |
protected $field_selectors;
|
@@ -68,6 +74,7 @@ class Yoast_ACF_Analysis_Configuration {
|
|
68 |
}
|
69 |
|
70 |
// Fall back on filter use.
|
|
|
71 |
return apply_filters( 'acf/get_info', 'version' );
|
72 |
}
|
73 |
|
@@ -98,7 +105,6 @@ class Yoast_ACF_Analysis_Configuration {
|
|
98 |
}
|
99 |
|
100 |
return $this->blacklist_type;
|
101 |
-
|
102 |
}
|
103 |
|
104 |
/**
|
@@ -243,6 +249,34 @@ class Yoast_ACF_Analysis_Configuration {
|
|
243 |
return $this->field_selectors;
|
244 |
}
|
245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
/**
|
247 |
* Retrieves an array representation of the current object.
|
248 |
*
|
@@ -257,6 +291,7 @@ class Yoast_ACF_Analysis_Configuration {
|
|
257 |
'blacklistType' => $this->get_blacklist_type()->to_array(),
|
258 |
'blacklistName' => $this->get_blacklist_name()->to_array(),
|
259 |
'fieldSelectors' => $this->get_field_selectors()->to_array(),
|
|
|
260 |
'debug' => $this->is_debug(),
|
261 |
);
|
262 |
}
|
11 |
class Yoast_ACF_Analysis_Configuration {
|
12 |
|
13 |
/**
|
14 |
+
* The blacklist type.
|
15 |
+
*
|
16 |
* @var Yoast_ACF_Analysis_String_Store
|
17 |
*/
|
18 |
protected $blacklist_type;
|
19 |
|
20 |
/**
|
21 |
+
* The blacklist's name.
|
22 |
+
*
|
23 |
* @var Yoast_ACF_Analysis_String_Store
|
24 |
*/
|
25 |
protected $blacklist_name;
|
26 |
|
27 |
/**
|
28 |
+
* The field selectors for usage in ACF4.
|
29 |
+
*
|
30 |
* @var Yoast_ACF_Analysis_String_Store
|
31 |
*/
|
32 |
protected $field_selectors;
|
74 |
}
|
75 |
|
76 |
// Fall back on filter use.
|
77 |
+
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- ACF hook.
|
78 |
return apply_filters( 'acf/get_info', 'version' );
|
79 |
}
|
80 |
|
105 |
}
|
106 |
|
107 |
return $this->blacklist_type;
|
|
|
108 |
}
|
109 |
|
110 |
/**
|
249 |
return $this->field_selectors;
|
250 |
}
|
251 |
|
252 |
+
/**
|
253 |
+
* Retrieves the field order.
|
254 |
+
*
|
255 |
+
* @return array The field order configuration.
|
256 |
+
*/
|
257 |
+
public function get_field_order() {
|
258 |
+
/**
|
259 |
+
* Filters the order of the ACF fields relative to the post_content.
|
260 |
+
*
|
261 |
+
* The array has the ACF field key as the array key and the value should be an integer
|
262 |
+
* where negative values result in the field value being placed before the default post_content.
|
263 |
+
*
|
264 |
+
* This is how to force the field with the key "field_591eb45f2be86" to be placed before the post_content:
|
265 |
+
*
|
266 |
+
* $order_config = array(
|
267 |
+
* 'field_591eb45f2be86' => -1
|
268 |
+
* );
|
269 |
+
*
|
270 |
+
* @since 2.2.0
|
271 |
+
*
|
272 |
+
* @param array $order_config {
|
273 |
+
* @type string $field_name Name of the ACF field
|
274 |
+
* @type int $order Integer
|
275 |
+
* }
|
276 |
+
*/
|
277 |
+
return apply_filters( Yoast_ACF_Analysis_Facade::get_filter_name( 'field_order' ), array() );
|
278 |
+
}
|
279 |
+
|
280 |
/**
|
281 |
* Retrieves an array representation of the current object.
|
282 |
*
|
291 |
'blacklistType' => $this->get_blacklist_type()->to_array(),
|
292 |
'blacklistName' => $this->get_blacklist_name()->to_array(),
|
293 |
'fieldSelectors' => $this->get_field_selectors()->to_array(),
|
294 |
+
'fieldOrder' => $this->get_field_order(),
|
295 |
'debug' => $this->is_debug(),
|
296 |
);
|
297 |
}
|
inc/configuration/string-store.php
CHANGED
@@ -44,7 +44,7 @@ class Yoast_ACF_Analysis_String_Store {
|
|
44 |
*
|
45 |
* @param string $item Item to remove from the store.
|
46 |
*
|
47 |
-
* @return bool True if the item was
|
48 |
*/
|
49 |
public function remove( $item ) {
|
50 |
if ( ! is_string( $item ) ) {
|
@@ -54,11 +54,9 @@ class Yoast_ACF_Analysis_String_Store {
|
|
54 |
if ( ! in_array( $item, $this->items, true ) ) {
|
55 |
return false;
|
56 |
}
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
)
|
61 |
-
);
|
62 |
sort( $this->items );
|
63 |
|
64 |
return true;
|
@@ -72,5 +70,4 @@ class Yoast_ACF_Analysis_String_Store {
|
|
72 |
public function to_array() {
|
73 |
return $this->items;
|
74 |
}
|
75 |
-
|
76 |
}
|
44 |
*
|
45 |
* @param string $item Item to remove from the store.
|
46 |
*
|
47 |
+
* @return bool True if the item was removed, false if it failed.
|
48 |
*/
|
49 |
public function remove( $item ) {
|
50 |
if ( ! is_string( $item ) ) {
|
54 |
if ( ! in_array( $item, $this->items, true ) ) {
|
55 |
return false;
|
56 |
}
|
57 |
+
|
58 |
+
$items = array_diff( $this->items, array( $item ) );
|
59 |
+
$this->items = array_values( $items );
|
|
|
|
|
60 |
sort( $this->items );
|
61 |
|
62 |
return true;
|
70 |
public function to_array() {
|
71 |
return $this->items;
|
72 |
}
|
|
|
73 |
}
|
inc/dependencies/dependency-acf.php
CHANGED
@@ -43,5 +43,4 @@ final class Yoast_ACF_Analysis_Dependency_ACF implements Yoast_ACF_Analysis_Depe
|
|
43 |
|
44 |
printf( '<div class="error"><p>%s</p></div>', esc_html( $message ) );
|
45 |
}
|
46 |
-
|
47 |
}
|
43 |
|
44 |
printf( '<div class="error"><p>%s</p></div>', esc_html( $message ) );
|
45 |
}
|
|
|
46 |
}
|
inc/dependencies/dependency-interface.php
CHANGED
@@ -9,6 +9,7 @@
|
|
9 |
* Interface Yoast_ACF_Analysis_Dependency.
|
10 |
*/
|
11 |
interface Yoast_ACF_Analysis_Dependency {
|
|
|
12 |
/**
|
13 |
* Checks if this dependency is met.
|
14 |
*
|
9 |
* Interface Yoast_ACF_Analysis_Dependency.
|
10 |
*/
|
11 |
interface Yoast_ACF_Analysis_Dependency {
|
12 |
+
|
13 |
/**
|
14 |
* Checks if this dependency is met.
|
15 |
*
|
inc/dependencies/dependency-yoast-seo.php
CHANGED
@@ -93,5 +93,4 @@ final class Yoast_ACF_Analysis_Dependency_Yoast_SEO implements Yoast_ACF_Analysi
|
|
93 |
private function has_required_version() {
|
94 |
return -1 !== version_compare( $this->get_major_version( WPSEO_VERSION ), self::MINIMAL_REQUIRED_VERSION );
|
95 |
}
|
96 |
-
|
97 |
}
|
93 |
private function has_required_version() {
|
94 |
return -1 !== version_compare( $this->get_major_version( WPSEO_VERSION ), self::MINIMAL_REQUIRED_VERSION );
|
95 |
}
|
|
|
96 |
}
|
inc/registry.php
CHANGED
@@ -37,5 +37,4 @@ class Yoast_ACF_Analysis_Registry {
|
|
37 |
public function get( $id ) {
|
38 |
return array_key_exists( $id, $this->storage ) ? $this->storage[ $id ] : null;
|
39 |
}
|
40 |
-
|
41 |
}
|
37 |
public function get( $id ) {
|
38 |
return array_key_exists( $id, $this->storage ) ? $this->storage[ $id ] : null;
|
39 |
}
|
|
|
40 |
}
|
inc/requirements.php
CHANGED
@@ -50,5 +50,4 @@ class Yoast_ACF_Analysis_Requirements {
|
|
50 |
|
51 |
return $all_are_met;
|
52 |
}
|
53 |
-
|
54 |
}
|
50 |
|
51 |
return $all_are_met;
|
52 |
}
|
|
|
53 |
}
|
js/src/collect/collect.js
CHANGED
@@ -9,7 +9,7 @@ var Collect = function() {
|
|
9 |
};
|
10 |
|
11 |
Collect.prototype.getFieldData = function() {
|
12 |
-
var field_data = this.filterBroken( this.filterBlacklistName( this.filterBlacklistType( this.getData() ) ) );
|
13 |
|
14 |
var used_types = _.uniq( _.pluck( field_data, "type" ) );
|
15 |
|
@@ -34,6 +34,10 @@ Collect.prototype.append = function( data ) {
|
|
34 |
|
35 |
_.each( field_data, function( field ) {
|
36 |
if ( typeof field.content !== "undefined" && field.content !== "" ) {
|
|
|
|
|
|
|
|
|
37 |
data += "\n" + field.content;
|
38 |
}
|
39 |
} );
|
@@ -74,4 +78,18 @@ Collect.prototype.filterBroken = function( field_data ) {
|
|
74 |
} );
|
75 |
};
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
module.exports = new Collect();
|
9 |
};
|
10 |
|
11 |
Collect.prototype.getFieldData = function() {
|
12 |
+
var field_data = this.sort( this.filterBroken( this.filterBlacklistName( this.filterBlacklistType( this.getData() ) ) ) );
|
13 |
|
14 |
var used_types = _.uniq( _.pluck( field_data, "type" ) );
|
15 |
|
34 |
|
35 |
_.each( field_data, function( field ) {
|
36 |
if ( typeof field.content !== "undefined" && field.content !== "" ) {
|
37 |
+
if ( field.order < 0 ) {
|
38 |
+
data = field.content + "\n" + data;
|
39 |
+
return;
|
40 |
+
}
|
41 |
data += "\n" + field.content;
|
42 |
}
|
43 |
} );
|
78 |
} );
|
79 |
};
|
80 |
|
81 |
+
Collect.prototype.sort = function( field_data ) {
|
82 |
+
if ( typeof config.fieldOrder === "undefined" || ! config.fieldOrder ) {
|
83 |
+
return field_data;
|
84 |
+
}
|
85 |
+
|
86 |
+
_.each( field_data, function( field ) {
|
87 |
+
field.order = ( typeof config.fieldOrder[ field.key ] === "undefined" ) ? 0 : config.fieldOrder[ field.key ];
|
88 |
+
} );
|
89 |
+
|
90 |
+
return field_data.sort( function( a, b ) {
|
91 |
+
return a.order > b.order;
|
92 |
+
} );
|
93 |
+
};
|
94 |
+
|
95 |
module.exports = new Collect();
|
js/src/scraper-store.js
CHANGED
@@ -20,7 +20,7 @@ var scraperObjects = {
|
|
20 |
// Relational
|
21 |
taxonomy: require( "./scraper/scraper.taxonomy.js" ),
|
22 |
|
23 |
-
// jQuery
|
24 |
// TODO: google_map, date_picker, color_picker
|
25 |
|
26 |
};
|
20 |
// Relational
|
21 |
taxonomy: require( "./scraper/scraper.taxonomy.js" ),
|
22 |
|
23 |
+
// Third-party / jQuery
|
24 |
// TODO: google_map, date_picker, color_picker
|
25 |
|
26 |
};
|
js/src/scraper/scraper.text.js
CHANGED
@@ -25,6 +25,8 @@ Scraper.prototype.wrapInHeadline = function( field ) {
|
|
25 |
var level = this.isHeadline( field );
|
26 |
if ( level ) {
|
27 |
field.content = "<h" + level + ">" + field.content + "</h" + level + ">";
|
|
|
|
|
28 |
}
|
29 |
|
30 |
return field;
|
25 |
var level = this.isHeadline( field );
|
26 |
if ( level ) {
|
27 |
field.content = "<h" + level + ">" + field.content + "</h" + level + ">";
|
28 |
+
} else {
|
29 |
+
field.content = "<p>" + field.content + "</p>";
|
30 |
}
|
31 |
|
32 |
return field;
|
js/src/scraper/scraper.textarea.js
CHANGED
@@ -8,7 +8,7 @@ Scraper.prototype.scrape = function( fields ) {
|
|
8 |
return field;
|
9 |
}
|
10 |
|
11 |
-
field.content = field.$el.find( "textarea[id^=acf]" ).val();
|
12 |
|
13 |
return field;
|
14 |
} );
|
8 |
return field;
|
9 |
}
|
10 |
|
11 |
+
field.content = "<p>" + field.$el.find( "textarea[id^=acf]" ).val() + "</p>";
|
12 |
|
13 |
return field;
|
14 |
} );
|
js/yoast-acf-analysis.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
(function e
|
2 |
/* global YoastSEO, acf, _, jQuery, wp */
|
3 |
var config = require( "./config/config.js" );
|
4 |
var helper = require( "./helper.js" );
|
@@ -282,7 +282,7 @@ var Collect = function() {
|
|
282 |
};
|
283 |
|
284 |
Collect.prototype.getFieldData = function() {
|
285 |
-
var field_data = this.filterBroken( this.filterBlacklistName( this.filterBlacklistType( this.getData() ) ) );
|
286 |
|
287 |
var used_types = _.uniq( _.pluck( field_data, "type" ) );
|
288 |
|
@@ -307,6 +307,10 @@ Collect.prototype.append = function( data ) {
|
|
307 |
|
308 |
_.each( field_data, function( field ) {
|
309 |
if ( typeof field.content !== "undefined" && field.content !== "" ) {
|
|
|
|
|
|
|
|
|
310 |
data += "\n" + field.content;
|
311 |
}
|
312 |
} );
|
@@ -347,6 +351,20 @@ Collect.prototype.filterBroken = function( field_data ) {
|
|
347 |
} );
|
348 |
};
|
349 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
module.exports = new Collect();
|
351 |
|
352 |
},{"./../config/config.js":7,"./../helper.js":8,"./../scraper-store.js":11,"./collect-v4.js":4,"./collect-v5.js":5}],7:[function(require,module,exports){
|
@@ -454,7 +472,7 @@ var scraperObjects = {
|
|
454 |
// Relational
|
455 |
taxonomy: require( "./scraper/scraper.taxonomy.js" ),
|
456 |
|
457 |
-
// jQuery
|
458 |
// TODO: google_map, date_picker, color_picker
|
459 |
|
460 |
};
|
@@ -747,6 +765,8 @@ Scraper.prototype.wrapInHeadline = function( field ) {
|
|
747 |
var level = this.isHeadline( field );
|
748 |
if ( level ) {
|
749 |
field.content = "<h" + level + ">" + field.content + "</h" + level + ">";
|
|
|
|
|
750 |
}
|
751 |
|
752 |
return field;
|
@@ -783,7 +803,7 @@ Scraper.prototype.scrape = function( fields ) {
|
|
783 |
return field;
|
784 |
}
|
785 |
|
786 |
-
field.content = field.$el.find( "textarea[id^=acf]" ).val();
|
787 |
|
788 |
return field;
|
789 |
} );
|
1 |
+
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
2 |
/* global YoastSEO, acf, _, jQuery, wp */
|
3 |
var config = require( "./config/config.js" );
|
4 |
var helper = require( "./helper.js" );
|
282 |
};
|
283 |
|
284 |
Collect.prototype.getFieldData = function() {
|
285 |
+
var field_data = this.sort( this.filterBroken( this.filterBlacklistName( this.filterBlacklistType( this.getData() ) ) ) );
|
286 |
|
287 |
var used_types = _.uniq( _.pluck( field_data, "type" ) );
|
288 |
|
307 |
|
308 |
_.each( field_data, function( field ) {
|
309 |
if ( typeof field.content !== "undefined" && field.content !== "" ) {
|
310 |
+
if ( field.order < 0 ) {
|
311 |
+
data = field.content + "\n" + data;
|
312 |
+
return;
|
313 |
+
}
|
314 |
data += "\n" + field.content;
|
315 |
}
|
316 |
} );
|
351 |
} );
|
352 |
};
|
353 |
|
354 |
+
Collect.prototype.sort = function( field_data ) {
|
355 |
+
if ( typeof config.fieldOrder === "undefined" || ! config.fieldOrder ) {
|
356 |
+
return field_data;
|
357 |
+
}
|
358 |
+
|
359 |
+
_.each( field_data, function( field ) {
|
360 |
+
field.order = ( typeof config.fieldOrder[ field.key ] === "undefined" ) ? 0 : config.fieldOrder[ field.key ];
|
361 |
+
} );
|
362 |
+
|
363 |
+
return field_data.sort( function( a, b ) {
|
364 |
+
return a.order > b.order;
|
365 |
+
} );
|
366 |
+
};
|
367 |
+
|
368 |
module.exports = new Collect();
|
369 |
|
370 |
},{"./../config/config.js":7,"./../helper.js":8,"./../scraper-store.js":11,"./collect-v4.js":4,"./collect-v5.js":5}],7:[function(require,module,exports){
|
472 |
// Relational
|
473 |
taxonomy: require( "./scraper/scraper.taxonomy.js" ),
|
474 |
|
475 |
+
// Third-party / jQuery
|
476 |
// TODO: google_map, date_picker, color_picker
|
477 |
|
478 |
};
|
765 |
var level = this.isHeadline( field );
|
766 |
if ( level ) {
|
767 |
field.content = "<h" + level + ">" + field.content + "</h" + level + ">";
|
768 |
+
} else {
|
769 |
+
field.content = "<p>" + field.content + "</p>";
|
770 |
}
|
771 |
|
772 |
return field;
|
803 |
return field;
|
804 |
}
|
805 |
|
806 |
+
field.content = "<p>" + field.$el.find( "textarea[id^=acf]" ).val() + "</p>";
|
807 |
|
808 |
return field;
|
809 |
} );
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== ACF Content Analysis for Yoast SEO ===
|
2 |
Contributors: yoast, angrycreative, kraftner, marcusforsberg, viktorfroberg, joostdevalk, atimmer, jipmoors, theorboman
|
3 |
Tags: Yoast, SEO, ACF, Advanced Custom Fields, analysis, Search Engine Optimization
|
4 |
-
Requires at least: 4.
|
5 |
-
Tested up to:
|
6 |
License: GPLv3
|
7 |
License URI: http://www.gnu.org/licenses/gpl.html
|
8 |
-
Stable tag: 2.
|
9 |
Requires PHP: 5.2.4
|
10 |
|
11 |
WordPress plugin that adds the content of all ACF fields to the Yoast SEO score analysis.
|
@@ -55,6 +55,18 @@ Previously called Yoast ACF Analysis.
|
|
55 |
|
56 |
== Changelog ==
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
= 2.1.0 =
|
59 |
|
60 |
Released July 10th, 2018
|
1 |
=== ACF Content Analysis for Yoast SEO ===
|
2 |
Contributors: yoast, angrycreative, kraftner, marcusforsberg, viktorfroberg, joostdevalk, atimmer, jipmoors, theorboman
|
3 |
Tags: Yoast, SEO, ACF, Advanced Custom Fields, analysis, Search Engine Optimization
|
4 |
+
Requires at least: 4.9
|
5 |
+
Tested up to: 5.0.3
|
6 |
License: GPLv3
|
7 |
License URI: http://www.gnu.org/licenses/gpl.html
|
8 |
+
Stable tag: 2.2.0
|
9 |
Requires PHP: 5.2.4
|
10 |
|
11 |
WordPress plugin that adds the content of all ACF fields to the Yoast SEO score analysis.
|
55 |
|
56 |
== Changelog ==
|
57 |
|
58 |
+
= 2.2.0 =
|
59 |
+
|
60 |
+
Released January 22nd, 2019
|
61 |
+
|
62 |
+
Bugfixes:
|
63 |
+
|
64 |
+
* Fixes a bug where textarea and non-headline text content would not be wrapped in paragraphs for the analysis. Props [skaeser](https://github.com/skaeser).
|
65 |
+
|
66 |
+
Enhancements:
|
67 |
+
|
68 |
+
* Introduces the 'yoast-acf-analysis/field_order' filter which allows for adjusting the ACF field order. This also adds the possibility to prepend field content to WordPress' post_content using a negative field order. Props [skaeser](https://github.com/skaeser).
|
69 |
+
|
70 |
= 2.1.0 =
|
71 |
|
72 |
Released July 10th, 2018
|
tests/js/system/data/test-data-loader-functions.php
CHANGED
@@ -28,5 +28,4 @@ function yoast_acf_analysis_test_data_loader() {
|
|
28 |
}
|
29 |
|
30 |
require_once AC_SEO_ACF_ANALYSIS_PLUGIN_PATH . '/tests/js/system/data/acf' . $version . '.php';
|
31 |
-
|
32 |
}
|
28 |
}
|
29 |
|
30 |
require_once AC_SEO_ACF_ANALYSIS_PLUGIN_PATH . '/tests/js/system/data/acf' . $version . '.php';
|
|
|
31 |
}
|
tests/php/phpunit.xml.dist
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
verbose="true">
|
10 |
<testsuites>
|
11 |
<testsuite name="unit">
|
12 |
-
<directory suffix="
|
13 |
</testsuite>
|
14 |
</testsuites>
|
15 |
|
9 |
verbose="true">
|
10 |
<testsuites>
|
11 |
<testsuite name="unit">
|
12 |
+
<directory suffix="test.php">unit</directory>
|
13 |
</testsuite>
|
14 |
</testsuites>
|
15 |
|
tests/php/unit/Configuration/configuration-test.php
CHANGED
@@ -6,10 +6,15 @@ use Brain\Monkey;
|
|
6 |
use Brain\Monkey\Filters;
|
7 |
use Brain\Monkey\Functions;
|
8 |
|
|
|
|
|
|
|
9 |
class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
10 |
|
11 |
/**
|
12 |
-
*
|
|
|
|
|
13 |
*/
|
14 |
protected function setUp() {
|
15 |
parent::setUp();
|
@@ -17,13 +22,20 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
17 |
}
|
18 |
|
19 |
/**
|
20 |
-
*
|
|
|
|
|
21 |
*/
|
22 |
protected function tearDown() {
|
23 |
Monkey\tearDown();
|
24 |
parent::tearDown();
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
27 |
public function testEmpty() {
|
28 |
|
29 |
$configuration = new \Yoast_ACF_Analysis_Configuration(
|
@@ -41,6 +53,7 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
41 |
'blacklistType' => [],
|
42 |
'blacklistName' => [],
|
43 |
'fieldSelectors' => [],
|
|
|
44 |
'debug' => false,
|
45 |
],
|
46 |
$configuration->to_array()
|
@@ -49,6 +62,11 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
49 |
$this->assertEquals( Filters\applied( 'acf/get_info' ), 1 );
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
public function testACF5VersionFunction() {
|
53 |
$acf_version = '5.0.0';
|
54 |
Functions\when( 'acf_get_setting' )->justReturn( $acf_version );
|
@@ -63,6 +81,11 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
63 |
$this->assertEquals( $acf_version, $config['acfVersion'] );
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
66 |
public function testBlacklistTypeFilter() {
|
67 |
|
68 |
$blacklist_type = new \Yoast_ACF_Analysis_String_Store();
|
@@ -81,9 +104,13 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
81 |
->andReturn( $blacklist_type2 );
|
82 |
|
83 |
$this->assertSame( $blacklist_type2, $configuration->get_blacklist_type() );
|
84 |
-
|
85 |
}
|
86 |
|
|
|
|
|
|
|
|
|
|
|
87 |
public function testBlacklistTypeFilterInvalid() {
|
88 |
|
89 |
$store = new \Yoast_ACF_Analysis_String_Store();
|
@@ -102,6 +129,11 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
102 |
$this->assertSame( $store, $configuration->get_blacklist_type() );
|
103 |
}
|
104 |
|
|
|
|
|
|
|
|
|
|
|
105 |
public function testBlacklistNameFilter() {
|
106 |
|
107 |
$blacklist_name = new \Yoast_ACF_Analysis_String_Store();
|
@@ -122,6 +154,11 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
122 |
$this->assertSame( $blacklist_name2, $configuration->get_blacklist_name() );
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
|
|
125 |
public function testLegacyBlackistNameFilter() {
|
126 |
|
127 |
$blacklist_name = new \Yoast_ACF_Analysis_String_Store();
|
@@ -156,6 +193,11 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
156 |
$this->assertSame( $configuration->get_blacklist_name()->to_array(), [ 'some_field_name' ] );
|
157 |
}
|
158 |
|
|
|
|
|
|
|
|
|
|
|
159 |
public function testLegacyBlackistNameFilterInvalid() {
|
160 |
|
161 |
$blacklist_name = new \Yoast_ACF_Analysis_String_Store();
|
@@ -181,6 +223,11 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
181 |
$this->assertSame( $configuration->get_blacklist_name()->to_array(), [] );
|
182 |
}
|
183 |
|
|
|
|
|
|
|
|
|
|
|
184 |
public function testBlacklistNameFilterInvalid() {
|
185 |
|
186 |
$store = new \Yoast_ACF_Analysis_String_Store();
|
@@ -199,6 +246,11 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
199 |
$this->assertSame( $store, $configuration->get_blacklist_name() );
|
200 |
}
|
201 |
|
|
|
|
|
|
|
|
|
|
|
202 |
public function testScraperConfigFilter() {
|
203 |
$config = array();
|
204 |
$blacklist = new \Yoast_ACF_Analysis_String_Store();
|
@@ -217,6 +269,11 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
217 |
$this->assertSame( $config, $configuration->get_scraper_config() );
|
218 |
}
|
219 |
|
|
|
|
|
|
|
|
|
|
|
220 |
public function testInvalidScraperConfigFilter() {
|
221 |
$blacklist = new \Yoast_ACF_Analysis_String_Store();
|
222 |
|
@@ -234,6 +291,11 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
234 |
$this->assertSame( array(), $configuration->get_scraper_config() );
|
235 |
}
|
236 |
|
|
|
|
|
|
|
|
|
|
|
237 |
public function testRefreshRateFilter() {
|
238 |
Filters\expectApplied( \Yoast_ACF_Analysis_Facade::get_filter_name( 'refresh_rate' ) )
|
239 |
->once()
|
@@ -249,6 +311,11 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
249 |
$this->assertSame( 9999, $configuration->get_refresh_rate() );
|
250 |
}
|
251 |
|
|
|
|
|
|
|
|
|
|
|
252 |
public function testRefreshRateMinimumValueFilter() {
|
253 |
Filters\expectApplied( \Yoast_ACF_Analysis_Facade::get_filter_name( 'refresh_rate' ) )
|
254 |
->once()
|
@@ -264,6 +331,11 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
264 |
$this->assertSame( 200, $configuration->get_refresh_rate() );
|
265 |
}
|
266 |
|
|
|
|
|
|
|
|
|
|
|
267 |
public function testFieldSelectorsFilter() {
|
268 |
$custom_store = new \Yoast_ACF_Analysis_String_Store();
|
269 |
$field_selector = new \Yoast_ACF_Analysis_String_Store();
|
@@ -282,6 +354,11 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
282 |
$this->assertSame( $custom_store, $configuration->get_field_selectors() );
|
283 |
}
|
284 |
|
|
|
|
|
|
|
|
|
|
|
285 |
public function testFieldSelectorsFilterInvalid() {
|
286 |
|
287 |
$store = new \Yoast_ACF_Analysis_String_Store();
|
@@ -298,6 +375,5 @@ class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
|
298 |
->andReturn( '' );
|
299 |
|
300 |
$this->assertSame( $store, $configuration->get_field_selectors() );
|
301 |
-
|
302 |
}
|
303 |
}
|
6 |
use Brain\Monkey\Filters;
|
7 |
use Brain\Monkey\Functions;
|
8 |
|
9 |
+
/**
|
10 |
+
* Class Configuration_Test
|
11 |
+
*/
|
12 |
class Configuration_Test extends \PHPUnit_Framework_TestCase {
|
13 |
|
14 |
/**
|
15 |
+
* Sets up test fixtures.
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
*/
|
19 |
protected function setUp() {
|
20 |
parent::setUp();
|
22 |
}
|
23 |
|
24 |
/**
|
25 |
+
* Tears down test fixtures previously setup.
|
26 |
+
*
|
27 |
+
* @return void
|
28 |
*/
|
29 |
protected function tearDown() {
|
30 |
Monkey\tearDown();
|
31 |
parent::tearDown();
|
32 |
}
|
33 |
|
34 |
+
/**
|
35 |
+
* Tests empty configurations.
|
36 |
+
*
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
public function testEmpty() {
|
40 |
|
41 |
$configuration = new \Yoast_ACF_Analysis_Configuration(
|
53 |
'blacklistType' => [],
|
54 |
'blacklistName' => [],
|
55 |
'fieldSelectors' => [],
|
56 |
+
'fieldOrder' => [],
|
57 |
'debug' => false,
|
58 |
],
|
59 |
$configuration->to_array()
|
62 |
$this->assertEquals( Filters\applied( 'acf/get_info' ), 1 );
|
63 |
}
|
64 |
|
65 |
+
/**
|
66 |
+
* Tests the ACF version 5 function.
|
67 |
+
*
|
68 |
+
* @return void
|
69 |
+
*/
|
70 |
public function testACF5VersionFunction() {
|
71 |
$acf_version = '5.0.0';
|
72 |
Functions\when( 'acf_get_setting' )->justReturn( $acf_version );
|
81 |
$this->assertEquals( $acf_version, $config['acfVersion'] );
|
82 |
}
|
83 |
|
84 |
+
/**
|
85 |
+
* Tests a valid blacklist type filter.
|
86 |
+
*
|
87 |
+
* @return void
|
88 |
+
*/
|
89 |
public function testBlacklistTypeFilter() {
|
90 |
|
91 |
$blacklist_type = new \Yoast_ACF_Analysis_String_Store();
|
104 |
->andReturn( $blacklist_type2 );
|
105 |
|
106 |
$this->assertSame( $blacklist_type2, $configuration->get_blacklist_type() );
|
|
|
107 |
}
|
108 |
|
109 |
+
/**
|
110 |
+
* Tests an invalid blacklist type filter.
|
111 |
+
*
|
112 |
+
* @return void
|
113 |
+
*/
|
114 |
public function testBlacklistTypeFilterInvalid() {
|
115 |
|
116 |
$store = new \Yoast_ACF_Analysis_String_Store();
|
129 |
$this->assertSame( $store, $configuration->get_blacklist_type() );
|
130 |
}
|
131 |
|
132 |
+
/**
|
133 |
+
* Tests a valid blacklist name filter.
|
134 |
+
*
|
135 |
+
* @return void
|
136 |
+
*/
|
137 |
public function testBlacklistNameFilter() {
|
138 |
|
139 |
$blacklist_name = new \Yoast_ACF_Analysis_String_Store();
|
154 |
$this->assertSame( $blacklist_name2, $configuration->get_blacklist_name() );
|
155 |
}
|
156 |
|
157 |
+
/**
|
158 |
+
* Tests a valid legacy blacklist name filter.
|
159 |
+
*
|
160 |
+
* @return void
|
161 |
+
*/
|
162 |
public function testLegacyBlackistNameFilter() {
|
163 |
|
164 |
$blacklist_name = new \Yoast_ACF_Analysis_String_Store();
|
193 |
$this->assertSame( $configuration->get_blacklist_name()->to_array(), [ 'some_field_name' ] );
|
194 |
}
|
195 |
|
196 |
+
/**
|
197 |
+
* Tests an invalid legacy blacklist name filter.
|
198 |
+
*
|
199 |
+
* @return void
|
200 |
+
*/
|
201 |
public function testLegacyBlackistNameFilterInvalid() {
|
202 |
|
203 |
$blacklist_name = new \Yoast_ACF_Analysis_String_Store();
|
223 |
$this->assertSame( $configuration->get_blacklist_name()->to_array(), [] );
|
224 |
}
|
225 |
|
226 |
+
/**
|
227 |
+
* Tests an invalid blacklist name filter.
|
228 |
+
*
|
229 |
+
* @return void
|
230 |
+
*/
|
231 |
public function testBlacklistNameFilterInvalid() {
|
232 |
|
233 |
$store = new \Yoast_ACF_Analysis_String_Store();
|
246 |
$this->assertSame( $store, $configuration->get_blacklist_name() );
|
247 |
}
|
248 |
|
249 |
+
/**
|
250 |
+
* Tests a valid scraper config filter.
|
251 |
+
*
|
252 |
+
* @return void
|
253 |
+
*/
|
254 |
public function testScraperConfigFilter() {
|
255 |
$config = array();
|
256 |
$blacklist = new \Yoast_ACF_Analysis_String_Store();
|
269 |
$this->assertSame( $config, $configuration->get_scraper_config() );
|
270 |
}
|
271 |
|
272 |
+
/**
|
273 |
+
* Tests an invalid scraper config filter.
|
274 |
+
*
|
275 |
+
* @return void
|
276 |
+
*/
|
277 |
public function testInvalidScraperConfigFilter() {
|
278 |
$blacklist = new \Yoast_ACF_Analysis_String_Store();
|
279 |
|
291 |
$this->assertSame( array(), $configuration->get_scraper_config() );
|
292 |
}
|
293 |
|
294 |
+
/**
|
295 |
+
* Tests the refresh rate filter.
|
296 |
+
*
|
297 |
+
* @return void
|
298 |
+
*/
|
299 |
public function testRefreshRateFilter() {
|
300 |
Filters\expectApplied( \Yoast_ACF_Analysis_Facade::get_filter_name( 'refresh_rate' ) )
|
301 |
->once()
|
311 |
$this->assertSame( 9999, $configuration->get_refresh_rate() );
|
312 |
}
|
313 |
|
314 |
+
/**
|
315 |
+
* Tests the refresh rate minimum value filter.
|
316 |
+
*
|
317 |
+
* @return void
|
318 |
+
*/
|
319 |
public function testRefreshRateMinimumValueFilter() {
|
320 |
Filters\expectApplied( \Yoast_ACF_Analysis_Facade::get_filter_name( 'refresh_rate' ) )
|
321 |
->once()
|
331 |
$this->assertSame( 200, $configuration->get_refresh_rate() );
|
332 |
}
|
333 |
|
334 |
+
/**
|
335 |
+
* Tests a valid field selector filter.
|
336 |
+
*
|
337 |
+
* @return void
|
338 |
+
*/
|
339 |
public function testFieldSelectorsFilter() {
|
340 |
$custom_store = new \Yoast_ACF_Analysis_String_Store();
|
341 |
$field_selector = new \Yoast_ACF_Analysis_String_Store();
|
354 |
$this->assertSame( $custom_store, $configuration->get_field_selectors() );
|
355 |
}
|
356 |
|
357 |
+
/**
|
358 |
+
* Tests an invalid field selector filter.
|
359 |
+
*
|
360 |
+
* @return void
|
361 |
+
*/
|
362 |
public function testFieldSelectorsFilterInvalid() {
|
363 |
|
364 |
$store = new \Yoast_ACF_Analysis_String_Store();
|
375 |
->andReturn( '' );
|
376 |
|
377 |
$this->assertSame( $store, $configuration->get_field_selectors() );
|
|
|
378 |
}
|
379 |
}
|
tests/php/unit/Configuration/string-store-test.php
CHANGED
@@ -1,22 +1,36 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
namespace Yoast\AcfAnalysis\Tests\Configuration;
|
5 |
|
|
|
|
|
|
|
6 |
class String_Store_Test extends \PHPUnit_Framework_TestCase {
|
7 |
|
8 |
/**
|
9 |
-
*
|
|
|
|
|
10 |
*/
|
11 |
protected function getStore() {
|
12 |
return new \Yoast_ACF_Analysis_String_Store();
|
13 |
}
|
14 |
|
|
|
|
|
|
|
|
|
|
|
15 |
public function testEmpty() {
|
16 |
$store = $this->getStore();
|
17 |
$this->assertEmpty( $store->to_array() );
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
20 |
public function testAdd() {
|
21 |
|
22 |
$type = 'test';
|
@@ -25,9 +39,13 @@ class String_Store_Test extends \PHPUnit_Framework_TestCase {
|
|
25 |
$store->add( $type );
|
26 |
|
27 |
$this->assertSame( [ $type ], $store->to_array() );
|
28 |
-
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
public function testAddSame() {
|
32 |
|
33 |
$type = 'test';
|
@@ -37,9 +55,13 @@ class String_Store_Test extends \PHPUnit_Framework_TestCase {
|
|
37 |
$store->add( $type );
|
38 |
|
39 |
$this->assertSame( [ $type ], $store->to_array() );
|
40 |
-
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
43 |
public function testAddMultiple() {
|
44 |
|
45 |
$type_a = 'A';
|
@@ -50,9 +72,13 @@ class String_Store_Test extends \PHPUnit_Framework_TestCase {
|
|
50 |
$store->add( $type_b );
|
51 |
|
52 |
$this->assertSame( [ $type_a, $type_b ], $store->to_array() );
|
53 |
-
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
56 |
public function testAddMultipleSorting() {
|
57 |
|
58 |
$type_a = 'Z';
|
@@ -63,18 +89,26 @@ class String_Store_Test extends \PHPUnit_Framework_TestCase {
|
|
63 |
$store->add( $type_b );
|
64 |
|
65 |
$this->assertSame( [ $type_b, $type_a ], $store->to_array() );
|
66 |
-
|
67 |
}
|
68 |
|
|
|
|
|
|
|
|
|
|
|
69 |
public function testAddNonString() {
|
70 |
|
71 |
$store = $this->getStore();
|
72 |
|
73 |
$this->assertFalse( $store->add( 999 ) );
|
74 |
$this->assertEmpty( $store->to_array() );
|
75 |
-
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
|
|
78 |
public function testRemove() {
|
79 |
|
80 |
$type_a = 'A';
|
@@ -94,24 +128,30 @@ class String_Store_Test extends \PHPUnit_Framework_TestCase {
|
|
94 |
$store->remove( $type_b );
|
95 |
|
96 |
$this->assertEmpty( $store->to_array() );
|
97 |
-
|
98 |
}
|
99 |
|
|
|
|
|
|
|
|
|
|
|
100 |
public function testRemoveNonString() {
|
101 |
|
102 |
$store = $this->getStore();
|
103 |
$store->add( '999' );
|
104 |
|
105 |
$this->assertFalse( $store->remove( 999 ) );
|
106 |
-
|
107 |
}
|
108 |
|
|
|
|
|
|
|
|
|
|
|
109 |
public function testRemoveNonExist() {
|
110 |
|
111 |
$store = $this->getStore();
|
112 |
|
113 |
$this->assertFalse( $store->remove( 'test' ) );
|
114 |
-
|
115 |
}
|
116 |
-
|
117 |
}
|
1 |
<?php
|
2 |
|
|
|
3 |
namespace Yoast\AcfAnalysis\Tests\Configuration;
|
4 |
|
5 |
+
/**
|
6 |
+
* Class String_Store_Test
|
7 |
+
*/
|
8 |
class String_Store_Test extends \PHPUnit_Framework_TestCase {
|
9 |
|
10 |
/**
|
11 |
+
* Gets the blacklist string store.
|
12 |
+
*
|
13 |
+
* @return \Yoast_ACF_Analysis_String_Store The blacklist string store.
|
14 |
*/
|
15 |
protected function getStore() {
|
16 |
return new \Yoast_ACF_Analysis_String_Store();
|
17 |
}
|
18 |
|
19 |
+
/**
|
20 |
+
* Tests for an empty store.
|
21 |
+
*
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
public function testEmpty() {
|
25 |
$store = $this->getStore();
|
26 |
$this->assertEmpty( $store->to_array() );
|
27 |
}
|
28 |
|
29 |
+
/**
|
30 |
+
* Tests adding a type to the store.
|
31 |
+
*
|
32 |
+
* @return void
|
33 |
+
*/
|
34 |
public function testAdd() {
|
35 |
|
36 |
$type = 'test';
|
39 |
$store->add( $type );
|
40 |
|
41 |
$this->assertSame( [ $type ], $store->to_array() );
|
|
|
42 |
}
|
43 |
|
44 |
+
/**
|
45 |
+
* Tests that when attempting to add a duplicate item to the store, it gets ignored.
|
46 |
+
*
|
47 |
+
* @return void
|
48 |
+
*/
|
49 |
public function testAddSame() {
|
50 |
|
51 |
$type = 'test';
|
55 |
$store->add( $type );
|
56 |
|
57 |
$this->assertSame( [ $type ], $store->to_array() );
|
|
|
58 |
}
|
59 |
|
60 |
+
/**
|
61 |
+
* Tests successfully adding multiple, unique types to the store.
|
62 |
+
*
|
63 |
+
* @return void
|
64 |
+
*/
|
65 |
public function testAddMultiple() {
|
66 |
|
67 |
$type_a = 'A';
|
72 |
$store->add( $type_b );
|
73 |
|
74 |
$this->assertSame( [ $type_a, $type_b ], $store->to_array() );
|
|
|
75 |
}
|
76 |
|
77 |
+
/**
|
78 |
+
* Tests the sorting (in an alphabetical order) of types in the store, regardless of when they were added.
|
79 |
+
*
|
80 |
+
* @return void
|
81 |
+
*/
|
82 |
public function testAddMultipleSorting() {
|
83 |
|
84 |
$type_a = 'Z';
|
89 |
$store->add( $type_b );
|
90 |
|
91 |
$this->assertSame( [ $type_b, $type_a ], $store->to_array() );
|
|
|
92 |
}
|
93 |
|
94 |
+
/**
|
95 |
+
* Tests adding a non-string type to the store, which is considered invalid and thus shouldn't be stored.
|
96 |
+
*
|
97 |
+
* @return void
|
98 |
+
*/
|
99 |
public function testAddNonString() {
|
100 |
|
101 |
$store = $this->getStore();
|
102 |
|
103 |
$this->assertFalse( $store->add( 999 ) );
|
104 |
$this->assertEmpty( $store->to_array() );
|
|
|
105 |
}
|
106 |
|
107 |
+
/**
|
108 |
+
* Tests removing an existing type from the store.
|
109 |
+
*
|
110 |
+
* @return void
|
111 |
+
*/
|
112 |
public function testRemove() {
|
113 |
|
114 |
$type_a = 'A';
|
128 |
$store->remove( $type_b );
|
129 |
|
130 |
$this->assertEmpty( $store->to_array() );
|
|
|
131 |
}
|
132 |
|
133 |
+
/**
|
134 |
+
* Tests that non-string type items don't get removed, as they can't be added to begin with.
|
135 |
+
*
|
136 |
+
* @return void
|
137 |
+
*/
|
138 |
public function testRemoveNonString() {
|
139 |
|
140 |
$store = $this->getStore();
|
141 |
$store->add( '999' );
|
142 |
|
143 |
$this->assertFalse( $store->remove( 999 ) );
|
|
|
144 |
}
|
145 |
|
146 |
+
/**
|
147 |
+
* Tests removing a non-existent type from the store, resulting in an unsuccessful removal.
|
148 |
+
*
|
149 |
+
* @return void
|
150 |
+
*/
|
151 |
public function testRemoveNonExist() {
|
152 |
|
153 |
$store = $this->getStore();
|
154 |
|
155 |
$this->assertFalse( $store->remove( 'test' ) );
|
|
|
156 |
}
|
|
|
157 |
}
|
tests/php/unit/Dependencies/acf-dependency-test.php
CHANGED
@@ -4,9 +4,15 @@ namespace Yoast\AcfAnalysis\Tests\Dependencies;
|
|
4 |
|
5 |
use Brain\Monkey;
|
6 |
|
|
|
|
|
|
|
7 |
class ACF_Dependency_Test extends \PHPUnit_Framework_TestCase {
|
|
|
8 |
/**
|
9 |
-
*
|
|
|
|
|
10 |
*/
|
11 |
protected function setUp() {
|
12 |
parent::setUp();
|
@@ -14,19 +20,31 @@ class ACF_Dependency_Test extends \PHPUnit_Framework_TestCase {
|
|
14 |
}
|
15 |
|
16 |
/**
|
17 |
-
*
|
|
|
|
|
18 |
*/
|
19 |
protected function tearDown() {
|
20 |
Monkey\tearDown();
|
21 |
parent::tearDown();
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
public function testNoACFClassExists() {
|
25 |
$testee = new \Yoast_ACF_Analysis_Dependency_ACF();
|
26 |
|
27 |
$this->assertFalse( $testee->is_met() );
|
28 |
}
|
29 |
|
|
|
|
|
|
|
|
|
|
|
30 |
public function testACFClassExists() {
|
31 |
$testee = new \Yoast_ACF_Analysis_Dependency_ACF();
|
32 |
|
@@ -35,6 +53,11 @@ class ACF_Dependency_Test extends \PHPUnit_Framework_TestCase {
|
|
35 |
$this->assertTrue( $testee->is_met() );
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
38 |
public function testAdminNotice() {
|
39 |
$testee = new \Yoast_ACF_Analysis_Dependency_ACF();
|
40 |
$testee->register_notifications();
|
4 |
|
5 |
use Brain\Monkey;
|
6 |
|
7 |
+
/**
|
8 |
+
* Class ACF_Dependency_Test
|
9 |
+
*/
|
10 |
class ACF_Dependency_Test extends \PHPUnit_Framework_TestCase {
|
11 |
+
|
12 |
/**
|
13 |
+
* Sets up test fixtures.
|
14 |
+
*
|
15 |
+
* @return void
|
16 |
*/
|
17 |
protected function setUp() {
|
18 |
parent::setUp();
|
20 |
}
|
21 |
|
22 |
/**
|
23 |
+
* Tears down test fixtures previously setup.
|
24 |
+
*
|
25 |
+
* @return void
|
26 |
*/
|
27 |
protected function tearDown() {
|
28 |
Monkey\tearDown();
|
29 |
parent::tearDown();
|
30 |
}
|
31 |
|
32 |
+
/**
|
33 |
+
* Tests the situation where no ACF class exists.
|
34 |
+
*
|
35 |
+
* @return void
|
36 |
+
*/
|
37 |
public function testNoACFClassExists() {
|
38 |
$testee = new \Yoast_ACF_Analysis_Dependency_ACF();
|
39 |
|
40 |
$this->assertFalse( $testee->is_met() );
|
41 |
}
|
42 |
|
43 |
+
/**
|
44 |
+
* Tests the situation where the ACF class exists.
|
45 |
+
*
|
46 |
+
* @return void
|
47 |
+
*/
|
48 |
public function testACFClassExists() {
|
49 |
$testee = new \Yoast_ACF_Analysis_Dependency_ACF();
|
50 |
|
53 |
$this->assertTrue( $testee->is_met() );
|
54 |
}
|
55 |
|
56 |
+
/**
|
57 |
+
* Tests the admin notice.
|
58 |
+
*
|
59 |
+
* @return void
|
60 |
+
*/
|
61 |
public function testAdminNotice() {
|
62 |
$testee = new \Yoast_ACF_Analysis_Dependency_ACF();
|
63 |
$testee->register_notifications();
|
tests/php/unit/Dependencies/yoast-seo-dependency-test.php
CHANGED
@@ -4,12 +4,29 @@ namespace Yoast\AcfAnalysis\Tests\Dependencies;
|
|
4 |
|
5 |
use Brain\Monkey;
|
6 |
|
|
|
|
|
|
|
7 |
class Yoast_SEO_Dependency_Test extends \PHPUnit_Framework_TestCase {
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
protected $runTestInSeparateProcess = true;
|
10 |
|
11 |
/**
|
12 |
-
*
|
|
|
|
|
13 |
*/
|
14 |
protected function setUp() {
|
15 |
parent::setUp();
|
@@ -17,19 +34,31 @@ class Yoast_SEO_Dependency_Test extends \PHPUnit_Framework_TestCase {
|
|
17 |
}
|
18 |
|
19 |
/**
|
20 |
-
*
|
|
|
|
|
21 |
*/
|
22 |
protected function tearDown() {
|
23 |
Monkey\tearDown();
|
24 |
parent::tearDown();
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
27 |
public function testFail() {
|
28 |
$testee = new \Yoast_ACF_Analysis_Dependency_Yoast_SEO();
|
29 |
|
30 |
$this->assertFalse( $testee->is_met() );
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
public function testPass() {
|
34 |
define( 'WPSEO_VERSION', '4.0.0' );
|
35 |
|
@@ -37,6 +66,11 @@ class Yoast_SEO_Dependency_Test extends \PHPUnit_Framework_TestCase {
|
|
37 |
$this->assertTrue( $testee->is_met() );
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
40 |
public function testOldVersion() {
|
41 |
define( 'WPSEO_VERSION', '2.0.0' );
|
42 |
|
@@ -44,6 +78,11 @@ class Yoast_SEO_Dependency_Test extends \PHPUnit_Framework_TestCase {
|
|
44 |
$this->assertFalse( $testee->is_met() );
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
|
|
47 |
public function testAdminNotice() {
|
48 |
$testee = new \Yoast_ACF_Analysis_Dependency_Yoast_SEO();
|
49 |
$testee->register_notifications();
|
@@ -51,6 +90,11 @@ class Yoast_SEO_Dependency_Test extends \PHPUnit_Framework_TestCase {
|
|
51 |
$this->assertTrue( has_action( 'admin_notices', array( $testee, 'message_plugin_not_activated' ) ) );
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
|
|
54 |
public function testAdminNoticeMinimumVersion() {
|
55 |
define( 'WPSEO_VERSION', '2.0.0' );
|
56 |
|
4 |
|
5 |
use Brain\Monkey;
|
6 |
|
7 |
+
/**
|
8 |
+
* Class Yoast_SEO_Dependency_Test*
|
9 |
+
*/
|
10 |
class Yoast_SEO_Dependency_Test extends \PHPUnit_Framework_TestCase {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Whether or not to preserve the global state.
|
14 |
+
*
|
15 |
+
* @var bool
|
16 |
+
*/
|
17 |
+
protected $preserveGlobalState = false;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Whether or not to run each test in a separate process.
|
21 |
+
*
|
22 |
+
* @var bool
|
23 |
+
*/
|
24 |
protected $runTestInSeparateProcess = true;
|
25 |
|
26 |
/**
|
27 |
+
* Sets up test fixtures.
|
28 |
+
*
|
29 |
+
* @return void
|
30 |
*/
|
31 |
protected function setUp() {
|
32 |
parent::setUp();
|
34 |
}
|
35 |
|
36 |
/**
|
37 |
+
* Tears down test fixtures previously setup.
|
38 |
+
*
|
39 |
+
* @return void
|
40 |
*/
|
41 |
protected function tearDown() {
|
42 |
Monkey\tearDown();
|
43 |
parent::tearDown();
|
44 |
}
|
45 |
|
46 |
+
/**
|
47 |
+
* Tests that requirements are not met when Yoast SEO can't be found.
|
48 |
+
*
|
49 |
+
* @return void
|
50 |
+
*/
|
51 |
public function testFail() {
|
52 |
$testee = new \Yoast_ACF_Analysis_Dependency_Yoast_SEO();
|
53 |
|
54 |
$this->assertFalse( $testee->is_met() );
|
55 |
}
|
56 |
|
57 |
+
/**
|
58 |
+
* Tests that requirements are met when Yoast SEO can be found, based on the existence of a version number.
|
59 |
+
*
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
public function testPass() {
|
63 |
define( 'WPSEO_VERSION', '4.0.0' );
|
64 |
|
66 |
$this->assertTrue( $testee->is_met() );
|
67 |
}
|
68 |
|
69 |
+
/**
|
70 |
+
* Tests that requirements are not met when an old and incompatible version Yoast SEO is installed.
|
71 |
+
*
|
72 |
+
* @return void
|
73 |
+
*/
|
74 |
public function testOldVersion() {
|
75 |
define( 'WPSEO_VERSION', '2.0.0' );
|
76 |
|
78 |
$this->assertFalse( $testee->is_met() );
|
79 |
}
|
80 |
|
81 |
+
/**
|
82 |
+
* Tests the appearance of the admin notice when requirements are not met.
|
83 |
+
*
|
84 |
+
* @return void
|
85 |
+
*/
|
86 |
public function testAdminNotice() {
|
87 |
$testee = new \Yoast_ACF_Analysis_Dependency_Yoast_SEO();
|
88 |
$testee->register_notifications();
|
90 |
$this->assertTrue( has_action( 'admin_notices', array( $testee, 'message_plugin_not_activated' ) ) );
|
91 |
}
|
92 |
|
93 |
+
/**
|
94 |
+
* Tests the appearance of the admin notice when minimum version requirements are not met.
|
95 |
+
*
|
96 |
+
* @return void
|
97 |
+
*/
|
98 |
public function testAdminNoticeMinimumVersion() {
|
99 |
define( 'WPSEO_VERSION', '2.0.0' );
|
100 |
|
tests/php/unit/Doubles/failing-dependency.php
CHANGED
@@ -2,11 +2,15 @@
|
|
2 |
|
3 |
namespace Yoast\AcfAnalysis\Tests\Doubles;
|
4 |
|
|
|
|
|
|
|
5 |
class Failing_Dependency implements \Yoast_ACF_Analysis_Dependency {
|
|
|
6 |
/**
|
7 |
* Checks if this dependency is met.
|
8 |
*
|
9 |
-
* @return bool True when met,
|
10 |
*/
|
11 |
public function is_met() {
|
12 |
return false;
|
2 |
|
3 |
namespace Yoast\AcfAnalysis\Tests\Doubles;
|
4 |
|
5 |
+
/**
|
6 |
+
* Class Failing_Dependency
|
7 |
+
*/
|
8 |
class Failing_Dependency implements \Yoast_ACF_Analysis_Dependency {
|
9 |
+
|
10 |
/**
|
11 |
* Checks if this dependency is met.
|
12 |
*
|
13 |
+
* @return bool True when met, false when not met.
|
14 |
*/
|
15 |
public function is_met() {
|
16 |
return false;
|
tests/php/unit/Doubles/passing-dependency.php
CHANGED
@@ -2,11 +2,15 @@
|
|
2 |
|
3 |
namespace Yoast\AcfAnalysis\Tests\Doubles;
|
4 |
|
|
|
|
|
|
|
5 |
class Passing_Dependency implements \Yoast_ACF_Analysis_Dependency {
|
|
|
6 |
/**
|
7 |
* Checks if this dependency is met.
|
8 |
*
|
9 |
-
* @return bool True when met,
|
10 |
*/
|
11 |
public function is_met() {
|
12 |
return true;
|
2 |
|
3 |
namespace Yoast\AcfAnalysis\Tests\Doubles;
|
4 |
|
5 |
+
/**
|
6 |
+
* Class Passing_Dependency
|
7 |
+
*/
|
8 |
class Passing_Dependency implements \Yoast_ACF_Analysis_Dependency {
|
9 |
+
|
10 |
/**
|
11 |
* Checks if this dependency is met.
|
12 |
*
|
13 |
+
* @return bool True when met, false when not met.
|
14 |
*/
|
15 |
public function is_met() {
|
16 |
return true;
|
tests/php/unit/assets-test.php
CHANGED
@@ -5,12 +5,29 @@ namespace Yoast\AcfAnalysis\Tests\Assets;
|
|
5 |
use Brain\Monkey;
|
6 |
use Brain\Monkey\Functions;
|
7 |
|
|
|
|
|
|
|
8 |
class Assets_Test extends \PHPUnit_Framework_TestCase {
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
protected $runTestInSeparateProcess = true;
|
11 |
|
12 |
/**
|
13 |
-
*
|
|
|
|
|
14 |
*/
|
15 |
protected function setUp() {
|
16 |
parent::setUp();
|
@@ -18,13 +35,20 @@ class Assets_Test extends \PHPUnit_Framework_TestCase {
|
|
18 |
}
|
19 |
|
20 |
/**
|
21 |
-
*
|
|
|
|
|
22 |
*/
|
23 |
protected function tearDown() {
|
24 |
Monkey\tearDown();
|
25 |
parent::tearDown();
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
28 |
public function testInitHook() {
|
29 |
define( 'AC_SEO_ACF_ANALYSIS_PLUGIN_FILE', '/directory/file' );
|
30 |
Functions\expect( 'get_plugin_data' )
|
5 |
use Brain\Monkey;
|
6 |
use Brain\Monkey\Functions;
|
7 |
|
8 |
+
/**
|
9 |
+
* Class Assets_Test
|
10 |
+
*/
|
11 |
class Assets_Test extends \PHPUnit_Framework_TestCase {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Whether or not to preserve the global state.
|
15 |
+
*
|
16 |
+
* @var bool
|
17 |
+
*/
|
18 |
+
protected $preserveGlobalState = false;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Whether or not to run each test in a separate process.
|
22 |
+
*
|
23 |
+
* @var bool
|
24 |
+
*/
|
25 |
protected $runTestInSeparateProcess = true;
|
26 |
|
27 |
/**
|
28 |
+
* Sets up test fixtures.
|
29 |
+
*
|
30 |
+
* @return void
|
31 |
*/
|
32 |
protected function setUp() {
|
33 |
parent::setUp();
|
35 |
}
|
36 |
|
37 |
/**
|
38 |
+
* Tears down test fixtures previously setup.
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
*/
|
42 |
protected function tearDown() {
|
43 |
Monkey\tearDown();
|
44 |
parent::tearDown();
|
45 |
}
|
46 |
|
47 |
+
/**
|
48 |
+
* Test the init hook and determines whether the proper assets are loaded.
|
49 |
+
*
|
50 |
+
* @return void
|
51 |
+
*/
|
52 |
public function testInitHook() {
|
53 |
define( 'AC_SEO_ACF_ANALYSIS_PLUGIN_FILE', '/directory/file' );
|
54 |
Functions\expect( 'get_plugin_data' )
|
tests/php/unit/main-test.php
CHANGED
@@ -4,10 +4,15 @@ namespace Yoast\AcfAnalysis\Tests;
|
|
4 |
|
5 |
use Brain\Monkey;
|
6 |
|
|
|
|
|
|
|
7 |
class Main_Test extends \PHPUnit_Framework_TestCase {
|
8 |
|
9 |
/**
|
10 |
-
*
|
|
|
|
|
11 |
*/
|
12 |
protected function setUp() {
|
13 |
parent::setUp();
|
@@ -15,13 +20,20 @@ class Main_Test extends \PHPUnit_Framework_TestCase {
|
|
15 |
}
|
16 |
|
17 |
/**
|
18 |
-
*
|
|
|
|
|
19 |
*/
|
20 |
protected function tearDown() {
|
21 |
Monkey\tearDown();
|
22 |
parent::tearDown();
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
public function testInvalidConfig() {
|
26 |
$registry = \Yoast_ACF_Analysis_Facade::get_registry();
|
27 |
|
@@ -32,6 +44,5 @@ class Main_Test extends \PHPUnit_Framework_TestCase {
|
|
32 |
|
33 |
$this->assertNotSame( 'Invalid Config', $registry->get( 'config' ) );
|
34 |
$this->assertInstanceOf( \Yoast_ACF_Analysis_Configuration::class, $registry->get( 'config' ) );
|
35 |
-
|
36 |
}
|
37 |
}
|
4 |
|
5 |
use Brain\Monkey;
|
6 |
|
7 |
+
/**
|
8 |
+
* Class Main_Test
|
9 |
+
*/
|
10 |
class Main_Test extends \PHPUnit_Framework_TestCase {
|
11 |
|
12 |
/**
|
13 |
+
* Sets up test fixtures.
|
14 |
+
*
|
15 |
+
* @return void
|
16 |
*/
|
17 |
protected function setUp() {
|
18 |
parent::setUp();
|
20 |
}
|
21 |
|
22 |
/**
|
23 |
+
* Tears down test fixtures previously setup.
|
24 |
+
*
|
25 |
+
* @return void
|
26 |
*/
|
27 |
protected function tearDown() {
|
28 |
Monkey\tearDown();
|
29 |
parent::tearDown();
|
30 |
}
|
31 |
|
32 |
+
/**
|
33 |
+
* Tests invalid configurations.
|
34 |
+
*
|
35 |
+
* @return void
|
36 |
+
*/
|
37 |
public function testInvalidConfig() {
|
38 |
$registry = \Yoast_ACF_Analysis_Facade::get_registry();
|
39 |
|
44 |
|
45 |
$this->assertNotSame( 'Invalid Config', $registry->get( 'config' ) );
|
46 |
$this->assertInstanceOf( \Yoast_ACF_Analysis_Configuration::class, $registry->get( 'config' ) );
|
|
|
47 |
}
|
48 |
}
|
tests/php/unit/registry-test.php
CHANGED
@@ -1,10 +1,19 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
namespace Yoast\AcfAnalysis\Tests\Configuration;
|
5 |
|
|
|
|
|
|
|
6 |
class Registry_Test extends \PHPUnit_Framework_TestCase {
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
public function testSingleton() {
|
9 |
|
10 |
$first = \Yoast_ACF_Analysis_Facade::get_registry();
|
@@ -22,9 +31,13 @@ class Registry_Test extends \PHPUnit_Framework_TestCase {
|
|
22 |
);
|
23 |
|
24 |
$this->assertSame( $first, $second );
|
25 |
-
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
28 |
public function testAdd() {
|
29 |
|
30 |
$id = 'add';
|
@@ -37,7 +50,5 @@ class Registry_Test extends \PHPUnit_Framework_TestCase {
|
|
37 |
$registry->add( $id, $content );
|
38 |
|
39 |
$this->assertSame( $content, $registry->get( $id ) );
|
40 |
-
|
41 |
}
|
42 |
-
|
43 |
}
|
1 |
<?php
|
2 |
|
|
|
3 |
namespace Yoast\AcfAnalysis\Tests\Configuration;
|
4 |
|
5 |
+
/**
|
6 |
+
* Class Registry_Test
|
7 |
+
*/
|
8 |
class Registry_Test extends \PHPUnit_Framework_TestCase {
|
9 |
|
10 |
+
/**
|
11 |
+
* Tests that the singleton instance is properly set and that every call to the registry, is the same instance.
|
12 |
+
*
|
13 |
+
* Also checks that the content is the same when adding items to the registry and calling the instance.
|
14 |
+
*
|
15 |
+
* @return void
|
16 |
+
*/
|
17 |
public function testSingleton() {
|
18 |
|
19 |
$first = \Yoast_ACF_Analysis_Facade::get_registry();
|
31 |
);
|
32 |
|
33 |
$this->assertSame( $first, $second );
|
|
|
34 |
}
|
35 |
|
36 |
+
/**
|
37 |
+
* Tests that adding a non-existing item to the registy, succeeds and that the item can be found based on its ID.
|
38 |
+
*
|
39 |
+
* @return void
|
40 |
+
*/
|
41 |
public function testAdd() {
|
42 |
|
43 |
$id = 'add';
|
50 |
$registry->add( $id, $content );
|
51 |
|
52 |
$this->assertSame( $content, $registry->get( $id ) );
|
|
|
53 |
}
|
|
|
54 |
}
|
tests/php/unit/requirements-test.php
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
namespace Yoast\AcfAnalysis\Tests\Configuration;
|
5 |
|
6 |
use Brain\Monkey;
|
@@ -9,10 +8,13 @@ use Brain\Monkey\Filters;
|
|
9 |
use Yoast\AcfAnalysis\Tests\Doubles\Passing_Dependency;
|
10 |
use Yoast\AcfAnalysis\Tests\Doubles\Failing_Dependency;
|
11 |
|
|
|
|
|
|
|
12 |
class Requirements_Test extends \PHPUnit_Framework_TestCase {
|
13 |
|
14 |
/**
|
15 |
-
*
|
16 |
*/
|
17 |
protected function setUp() {
|
18 |
parent::setUp();
|
@@ -22,18 +24,28 @@ class Requirements_Test extends \PHPUnit_Framework_TestCase {
|
|
22 |
}
|
23 |
|
24 |
/**
|
25 |
-
*
|
26 |
*/
|
27 |
protected function tearDown() {
|
28 |
Monkey\tearDown();
|
29 |
parent::tearDown();
|
30 |
}
|
31 |
|
|
|
|
|
|
|
|
|
|
|
32 |
public function testNoDependencies() {
|
33 |
$testee = new \Yoast_ACF_Analysis_Requirements();
|
34 |
$this->assertTrue( $testee->are_met() );
|
35 |
}
|
36 |
|
|
|
|
|
|
|
|
|
|
|
37 |
public function testPassingDependency() {
|
38 |
$testee = new \Yoast_ACF_Analysis_Requirements();
|
39 |
$testee->add_dependency( new Passing_Dependency() );
|
@@ -41,6 +53,11 @@ class Requirements_Test extends \PHPUnit_Framework_TestCase {
|
|
41 |
$this->assertTrue( $testee->are_met() );
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
44 |
public function testFailingDependency() {
|
45 |
$testee = new \Yoast_ACF_Analysis_Requirements();
|
46 |
$testee->add_dependency( new Failing_Dependency() );
|
@@ -48,6 +65,11 @@ class Requirements_Test extends \PHPUnit_Framework_TestCase {
|
|
48 |
$this->assertFalse( $testee->are_met() );
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
51 |
public function testMixedDependencies() {
|
52 |
$testee = new \Yoast_ACF_Analysis_Requirements();
|
53 |
$testee->add_dependency( new Failing_Dependency() );
|
1 |
<?php
|
2 |
|
|
|
3 |
namespace Yoast\AcfAnalysis\Tests\Configuration;
|
4 |
|
5 |
use Brain\Monkey;
|
8 |
use Yoast\AcfAnalysis\Tests\Doubles\Passing_Dependency;
|
9 |
use Yoast\AcfAnalysis\Tests\Doubles\Failing_Dependency;
|
10 |
|
11 |
+
/**
|
12 |
+
* Class Requirements_Test
|
13 |
+
*/
|
14 |
class Requirements_Test extends \PHPUnit_Framework_TestCase {
|
15 |
|
16 |
/**
|
17 |
+
* Sets up test fixtures.
|
18 |
*/
|
19 |
protected function setUp() {
|
20 |
parent::setUp();
|
24 |
}
|
25 |
|
26 |
/**
|
27 |
+
* Tears down test fixtures previously set up.
|
28 |
*/
|
29 |
protected function tearDown() {
|
30 |
Monkey\tearDown();
|
31 |
parent::tearDown();
|
32 |
}
|
33 |
|
34 |
+
/**
|
35 |
+
* Tests the situation where there are no dependencies.
|
36 |
+
*
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
public function testNoDependencies() {
|
40 |
$testee = new \Yoast_ACF_Analysis_Requirements();
|
41 |
$this->assertTrue( $testee->are_met() );
|
42 |
}
|
43 |
|
44 |
+
/**
|
45 |
+
* Tests that requirements are met when a valid dependency is added.
|
46 |
+
*
|
47 |
+
* @return void
|
48 |
+
*/
|
49 |
public function testPassingDependency() {
|
50 |
$testee = new \Yoast_ACF_Analysis_Requirements();
|
51 |
$testee->add_dependency( new Passing_Dependency() );
|
53 |
$this->assertTrue( $testee->are_met() );
|
54 |
}
|
55 |
|
56 |
+
/**
|
57 |
+
* Tests that requirements are not met when an invalid dependency is added.
|
58 |
+
*
|
59 |
+
* @return void
|
60 |
+
*/
|
61 |
public function testFailingDependency() {
|
62 |
$testee = new \Yoast_ACF_Analysis_Requirements();
|
63 |
$testee->add_dependency( new Failing_Dependency() );
|
65 |
$this->assertFalse( $testee->are_met() );
|
66 |
}
|
67 |
|
68 |
+
/**
|
69 |
+
* Tests that requirements are not met when a mix of valid and invalid dependencies are added.
|
70 |
+
*
|
71 |
+
* @return void
|
72 |
+
*/
|
73 |
public function testMixedDependencies() {
|
74 |
$testee = new \Yoast_ACF_Analysis_Requirements();
|
75 |
$testee->add_dependency( new Failing_Dependency() );
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit2ef726570cbf453a5220f184849a44f5::getLoader();
|
vendor/autoload_52.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit7969cfa0158947fe7dd5be0511e3ba99::getLoader();
|
vendor/composer/ClassLoader.php
CHANGED
@@ -279,7 +279,7 @@ class ClassLoader
|
|
279 |
*/
|
280 |
public function setApcuPrefix($apcuPrefix)
|
281 |
{
|
282 |
-
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
|
283 |
}
|
284 |
|
285 |
/**
|
@@ -377,7 +377,7 @@ class ClassLoader
|
|
377 |
$subPath = $class;
|
378 |
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
379 |
$subPath = substr($subPath, 0, $lastPos);
|
380 |
-
$search = $subPath.'\\';
|
381 |
if (isset($this->prefixDirsPsr4[$search])) {
|
382 |
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
383 |
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
279 |
*/
|
280 |
public function setApcuPrefix($apcuPrefix)
|
281 |
{
|
282 |
+
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
283 |
}
|
284 |
|
285 |
/**
|
377 |
$subPath = $class;
|
378 |
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
379 |
$subPath = substr($subPath, 0, $lastPos);
|
380 |
+
$search = $subPath . '\\';
|
381 |
if (isset($this->prefixDirsPsr4[$search])) {
|
382 |
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
383 |
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitcdaf3b83475df6494f7f95979a2560ef
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit2ef726570cbf453a5220f184849a44f5
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit2ef726570cbf453a5220f184849a44f5', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit2ef726570cbf453a5220f184849a44f5', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit2ef726570cbf453a5220f184849a44f5::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_real_52.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real_52.php generated by xrstf/composer-php52
|
4 |
|
5 |
-
class
|
6 |
private static $loader;
|
7 |
|
8 |
public static function loadClassLoader($class) {
|
@@ -19,9 +19,9 @@ class ComposerAutoloaderInite32e41017a3502755df1f2a4f82e91b6 {
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$vendorDir = dirname(dirname(__FILE__));
|
27 |
$baseDir = dirname($vendorDir);
|
2 |
|
3 |
// autoload_real_52.php generated by xrstf/composer-php52
|
4 |
|
5 |
+
class ComposerAutoloaderInit7969cfa0158947fe7dd5be0511e3ba99 {
|
6 |
private static $loader;
|
7 |
|
8 |
public static function loadClassLoader($class) {
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit7969cfa0158947fe7dd5be0511e3ba99', 'loadClassLoader'), true /*, true */);
|
23 |
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit7969cfa0158947fe7dd5be0511e3ba99', 'loadClassLoader'));
|
25 |
|
26 |
$vendorDir = dirname(dirname(__FILE__));
|
27 |
$baseDir = dirname($vendorDir);
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'C' =>
|
@@ -133,10 +133,10 @@ class ComposerStaticInitcdaf3b83475df6494f7f95979a2560ef
|
|
133 |
public static function getInitializer(ClassLoader $loader)
|
134 |
{
|
135 |
return \Closure::bind(function () use ($loader) {
|
136 |
-
$loader->prefixLengthsPsr4 =
|
137 |
-
$loader->prefixDirsPsr4 =
|
138 |
-
$loader->prefixesPsr0 =
|
139 |
-
$loader->classMap =
|
140 |
|
141 |
}, null, ClassLoader::class);
|
142 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit2ef726570cbf453a5220f184849a44f5
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'C' =>
|
133 |
public static function getInitializer(ClassLoader $loader)
|
134 |
{
|
135 |
return \Closure::bind(function () use ($loader) {
|
136 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit2ef726570cbf453a5220f184849a44f5::$prefixLengthsPsr4;
|
137 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit2ef726570cbf453a5220f184849a44f5::$prefixDirsPsr4;
|
138 |
+
$loader->prefixesPsr0 = ComposerStaticInit2ef726570cbf453a5220f184849a44f5::$prefixesPsr0;
|
139 |
+
$loader->classMap = ComposerStaticInit2ef726570cbf453a5220f184849a44f5::$classMap;
|
140 |
|
141 |
}, null, ClassLoader::class);
|
142 |
}
|
yoast-acf-analysis.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* Plugin Name: ACF Content Analysis for Yoast SEO
|
9 |
* Plugin URI: https://wordpress.org/plugins/acf-content-analysis-for-yoast-seo/
|
10 |
* Description: Ensure that Yoast SEO analyzes all Advanced Custom Fields 4 and 5 content including Flexible Content and Repeaters.
|
11 |
-
* Version: 2.
|
12 |
* Author: Thomas Kräftner, ViktorFroberg, marol87, pekz0r, angrycreative, Team Yoast
|
13 |
* Author URI: http://angrycreative.se
|
14 |
* License: GPL v3
|
@@ -38,15 +38,6 @@ if ( is_file( AC_SEO_ACF_ANALYSIS_PLUGIN_PATH . $yoast_acf_autoload_file ) ) {
|
|
38 |
require AC_SEO_ACF_ANALYSIS_PLUGIN_PATH . $yoast_acf_autoload_file;
|
39 |
}
|
40 |
|
41 |
-
/**
|
42 |
-
* Loads translations.
|
43 |
-
*
|
44 |
-
* @deprecated 2.0.1
|
45 |
-
*/
|
46 |
-
function yoast_acf_analysis_load_textdomain() {
|
47 |
-
// As we require WordPress 4.6 and higher, we don't need to load the translation files manually anymore.
|
48 |
-
}
|
49 |
-
|
50 |
/**
|
51 |
* Triggers a message whenever the class is missing.
|
52 |
*/
|
@@ -70,3 +61,15 @@ function yoast_acf_report_missing_acf() {
|
|
70 |
);
|
71 |
echo '</p></div>';
|
72 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
* Plugin Name: ACF Content Analysis for Yoast SEO
|
9 |
* Plugin URI: https://wordpress.org/plugins/acf-content-analysis-for-yoast-seo/
|
10 |
* Description: Ensure that Yoast SEO analyzes all Advanced Custom Fields 4 and 5 content including Flexible Content and Repeaters.
|
11 |
+
* Version: 2.2.0
|
12 |
* Author: Thomas Kräftner, ViktorFroberg, marol87, pekz0r, angrycreative, Team Yoast
|
13 |
* Author URI: http://angrycreative.se
|
14 |
* License: GPL v3
|
38 |
require AC_SEO_ACF_ANALYSIS_PLUGIN_PATH . $yoast_acf_autoload_file;
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
/**
|
42 |
* Triggers a message whenever the class is missing.
|
43 |
*/
|
61 |
);
|
62 |
echo '</p></div>';
|
63 |
}
|
64 |
+
|
65 |
+
/* ********************* DEPRECATED FUNCTIONS ********************* */
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Loads translations.
|
69 |
+
*
|
70 |
+
* @deprecated 2.0.1
|
71 |
+
* @codeCoverageIgnore
|
72 |
+
*/
|
73 |
+
function yoast_acf_analysis_load_textdomain() {
|
74 |
+
// As we require WordPress 4.6 and higher, we don't need to load the translation files manually anymore.
|
75 |
+
}
|