| @@ -74,61 +74,21 @@ | ||
| 74 | 74 | 'args' => null !== $args ? $args : ( $is_js ? true : 'all' ) |
| 75 | 75 | ]; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - /** | |
| 79 | - * Resolve the assets sub-folder for a file: webpack output lives under | |
| 80 | - * assets/build/, committed static assets under assets/static/. Prefer the | |
| 81 | - * build copy when present, otherwise fall back to static. This lets every | |
| 82 | - * enqueue/register call use the same relative path regardless of which | |
| 83 | - * folder the file ends up in. | |
| 84 | - * | |
| 85 | - * The final `assets/` fallback matters for the Free/Pro version skew this | |
| 86 | - * class is shared across. Pro constructs this same Enqueue against its OWN | |
| 87 | - * plugin path, so when Free 4.8.0 runs alongside a Pro that predates the | |
| 88 | - * Node 24 restructure, Pro's files are still flat under assets/. Without | |
| 89 | - * this branch every one of them resolved to a non-existent assets/static/ | |
| 90 | - * path and 404'd. Ordering is deliberate: a matched pair never reaches the | |
| 91 | - * legacy branch, so this costs nothing in the normal case. | |
| 92 | - * | |
| 93 | - * Kept `protected` so a paired plugin can refine the search order. | |
| 94 | - */ | |
| 95 | - protected function asset_base( $filename ) { | |
| 96 | - foreach ( [ 'assets/build/', 'assets/static/', 'assets/' ] as $base ) { | |
| 97 | - if ( file_exists( path_join( $this->plugin_path, $base . $filename ) ) ) { | |
| 98 | - return $base; | |
| 99 | - } | |
| 100 | - } | |
| 101 | - | |
| 102 | - // Nothing on disk — keep the historical default so a genuinely missing | |
| 103 | - // file produces the same (broken) URL it always did, not a new shape. | |
| 104 | - return 'assets/static/'; | |
| 105 | - } | |
| 106 | - | |
| 107 | 78 | public function asset_url( $filename ) { |
| 108 | 79 | if ( filter_var( $filename, FILTER_VALIDATE_URL ) ) { |
| 109 | 80 | return $filename; |
| 110 | 81 | } |
| 111 | 82 | |
| 112 | - return esc_url( $this->plugin_url . $this->asset_base( $filename ) . $filename ); | |
| 83 | + return esc_url( $this->plugin_url . 'assets/' . $filename ); | |
| 113 | 84 | } |
| 114 | 85 | |
| 115 | - /** | |
| 116 | - * Explicit URL for a committed static asset under assets/static/. | |
| 117 | - */ | |
| 118 | - public function static_url( $filename ) { | |
| 119 | - if ( filter_var( $filename, FILTER_VALIDATE_URL ) ) { | |
| 120 | - return $filename; | |
| 121 | - } | |
| 122 | - | |
| 123 | - return esc_url( $this->plugin_url . 'assets/static/' . $filename ); | |
| 124 | - } | |
| 125 | - | |
| 126 | 86 | public function dist_path( $file ) { |
| 127 | - return path_join( $this->plugin_path, $this->asset_base( $file ) . $file ); | |
| 87 | + return path_join( $this->plugin_path, 'assets/' . $file ); | |
| 128 | 88 | } |
| 129 | 89 | |
| 130 | 90 | public function icon( $name, $is_admin = false ) { |
| 131 | - $_path = $is_admin ? 'assets/static/admin/images/' : 'assets/static/images/'; | |
| 91 | + $_path = $is_admin ? 'assets/admin/images/' : 'assets/images/'; | |
| 132 | 92 | return esc_url( $this->plugin_url . $_path . $name . '?v=' . $this->version ); |
| 133 | 93 | } |
| 134 | 94 | } |