Changeset 61323
- Timestamp:
- 11/30/2025 12:54:26 AM (3 months ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
src/wp-includes/class-wp-dependencies.php (modified) (3 diffs)
-
src/wp-includes/class-wp-script-modules.php (modified) (2 diffs)
-
src/wp-includes/class-wp-scripts.php (modified) (1 diff)
-
src/wp-includes/class-wp-styles.php (modified) (1 diff)
-
tests/phpunit/tests/dependencies/scripts.php (modified) (1 diff)
-
tests/phpunit/tests/dependencies/styles.php (modified) (1 diff)
-
tests/phpunit/tests/script-modules/wpScriptModules.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-dependencies.php
r61299 r61323 104 104 */ 105 105 private $queued_before_register = array(); 106 107 108 109 110 111 112 113 114 115 116 117 106 118 107 119 /** … … 200 212 } 201 213 202 $keep_going = true; 214 $keep_going = true; 215 $missing_dependencies = array(); 216 if ( isset( $this->registered[ $handle ] ) && count( $this->registered[ $handle ]->deps ) > 0 ) { 217 $missing_dependencies = array_diff( $this->registered[ $handle ]->deps, array_keys( $this->registered ) ); 218 } 203 219 if ( ! isset( $this->registered[ $handle ] ) ) { 204 220 $keep_going = false; // Item doesn't exist. 205 } elseif ( $this->registered[ $handle ]->deps && array_diff( $this->registered[ $handle ]->deps, array_keys( $this->registered ) ) ) { 221 } elseif ( count( $missing_dependencies ) > 0 ) { 222 if ( ! in_array( $handle, $this->dependencies_with_missing_dependencies, true ) ) { 223 _doing_it_wrong( 224 get_class( $this ) . '::add', 225 $this->get_dependency_warning_message( $handle, $missing_dependencies ), 226 '7.0.0' 227 ); 228 $this->dependencies_with_missing_dependencies[] = $handle; 229 } 206 230 $keep_going = false; // Item requires dependencies that don't exist. 207 231 } elseif ( $this->registered[ $handle ]->deps && ! $this->all_deps( $this->registered[ $handle ]->deps, true, $new_group ) ) { … … 536 560 return 'W/"' . md5( $etag ) . '"'; 537 561 } 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 538 580 } -
trunk/src/wp-includes/class-wp-script-modules.php
r61073 r61323 70 70 'high', 71 71 ); 72 73 74 75 76 77 78 79 80 81 82 72 83 73 84 /** … … 723 734 724 735 // If the item requires dependencies that do not exist, fail. 725 if ( count( array_diff( $dependency_ids, array_keys( $this->registered ) ) ) > 0 ) { 736 $missing_dependencies = array_diff( $dependency_ids, array_keys( $this->registered ) ); 737 if ( count( $missing_dependencies ) > 0 ) { 738 if ( ! in_array( $id, $this->modules_with_missing_dependencies, true ) ) { 739 _doing_it_wrong( 740 get_class( $this ) . '::register', 741 sprintf( 742 /* translators: 1: Script module ID, 2: Comma-separated list of missing dependency IDs. */ 743 __( 'The script module with the ID "%1$s" was enqueued with dependencies that are not registered: %2$s.' ), 744 $id, 745 implode( ', ', $missing_dependencies ) 746 ), 747 '7.0.0' 748 ); 749 $this->modules_with_missing_dependencies[] = $id; 750 } 751 726 752 return false; 727 753 } -
trunk/src/wp-includes/class-wp-scripts.php
r61223 r61323 1165 1165 $this->ext_handles = ''; 1166 1166 } 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1167 1185 } -
trunk/src/wp-includes/class-wp-styles.php
r61084 r61323 494 494 $this->print_html = ''; 495 495 } 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 496 514 } -
trunk/tests/phpunit/tests/dependencies/scripts.php
r61223 r61323 4094 4094 $this->assertStringNotContainsStringIgnoringCase( 'sourceURL=', $translations_script_data ); 4095 4095 } 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4096 4125 } -
trunk/tests/phpunit/tests/dependencies/styles.php
r61084 r61323 815 815 $this->assertEqualHTML( $expected, $printed ); 816 816 } 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 817 849 } -
trunk/tests/phpunit/tests/script-modules/wpScriptModules.php
r61073 r61323 2060 2060 ); 2061 2061 2062 $deregister( array( 'b', 'c ' ) );2062 $deregister( array( 'b', 'c' ) ); 2063 2063 2064 2064 // Test that registered dependency in footer doesn't place dependant in footer. … … 2313 2313 ); 2314 2314 } 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2315 2343 }
Note: See TracChangeset
for help on using the changeset viewer.