| @@ -128,9 +128,8 @@ | ||
| 128 | 128 | return $this; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * @since 4.0.0 added registration of style sheets generated by wordpress/scripts | |
| 133 | 132 | * @since 2.19.6 |
| 134 | 133 | * @return $this |
| 135 | 134 | */ |
| 136 | 135 | public function register() |
| @@ -137,32 +136,8 @@ | ||
| 137 | 136 | { |
| 138 | 137 | $scriptUrl = $this->pluginDirUrl . $this->relativeScriptPath; |
| 139 | 138 | $scriptAsset = $this->getAssetFileData(); |
| 140 | 139 | |
| 141 | - $stylePath = $this->getStylePath(); | |
| 142 | - $styleUrl = $this->getStyleUrl(); | |
| 143 | - | |
| 144 | - if (file_exists($stylePath)) { | |
| 145 | - wp_register_style( | |
| 146 | - $this->scriptId, | |
| 147 | - $styleUrl, | |
| 148 | - [], | |
| 149 | - $scriptAsset['version'] | |
| 150 | - ); | |
| 151 | - } | |
| 152 | - | |
| 153 | - $stylePathIndex = $this->getStylePath('style-'); | |
| 154 | - $styleUrlIndex = $this->getStyleUrl('style-'); | |
| 155 | - | |
| 156 | - if (file_exists($stylePathIndex)) { | |
| 157 | - wp_register_style( | |
| 158 | - 'style-' . $this->scriptId, | |
| 159 | - $styleUrlIndex, | |
| 160 | - [], | |
| 161 | - $scriptAsset['version'] | |
| 162 | - ); | |
| 163 | - } | |
| 164 | - | |
| 165 | 140 | wp_register_script( |
| 166 | 141 | $this->scriptId, |
| 167 | 142 | $scriptUrl, |
| 168 | 143 | $scriptAsset['dependencies'], |
| @@ -226,19 +201,10 @@ | ||
| 226 | 201 | { |
| 227 | 202 | if (!wp_script_is($this->scriptId, 'registered')) { |
| 228 | 203 | $this->register(); |
| 229 | 204 | } |
| 230 | - | |
| 231 | 205 | wp_enqueue_script($this->scriptId); |
| 232 | 206 | |
| 233 | - if (wp_style_is($this->scriptId, 'registered')) { | |
| 234 | - wp_enqueue_style($this->scriptId); | |
| 235 | - } | |
| 236 | - | |
| 237 | - if (wp_style_is('style-' . $this->scriptId, 'registered')) { | |
| 238 | - wp_enqueue_style('style-' . $this->scriptId); | |
| 239 | - } | |
| 240 | - | |
| 241 | 207 | return $this; |
| 242 | 208 | } |
| 243 | 209 | |
| 244 | 210 | /** |
| @@ -268,26 +234,7 @@ | ||
| 268 | 234 | $scriptAsset['dependencies'] = array_merge($this->scriptDependencies, $scriptAsset['dependencies']); |
| 269 | 235 | } |
| 270 | 236 | |
| 271 | 237 | return $scriptAsset; |
| 272 | - } | |
| 273 | - | |
| 274 | - /** | |
| 275 | - * @since 4.0.0 | |
| 276 | - */ | |
| 277 | - public function getStylePath($prefix = ''): string | |
| 278 | - { | |
| 279 | - return trailingslashit(dirname($this->absoluteScriptPath)) | |
| 280 | - . trim($prefix . basename($this->relativeScriptPath, '.js')) . '.css'; | |
| 281 | - } | |
| 282 | - | |
| 283 | - /** | |
| 284 | - * @since 4.0.0 | |
| 285 | - */ | |
| 286 | - public function getStyleUrl($prefix = ''): string | |
| 287 | - { | |
| 288 | - $cssFileName = trim($prefix . basename($this->relativeScriptPath, '.js')) . '.css'; | |
| 289 | - | |
| 290 | - return $this->pluginDirUrl . str_replace(basename($this->relativeScriptPath), $cssFileName, $this->relativeScriptPath); | |
| 291 | 238 | } |
| 292 | 239 | } |
| 293 | 240 | |