Draft: Basic implementation of plugin initializer
2 unresolved threads
2 unresolved threads
Signed-off-by: Bart Jaskulski bjaskulski@protonmail.com
Merge request reports
Activity
Filter activity
added 1 commit
- 5b64e13e - refactor: hookable driver should belong to separate package
added 1 commit
- 597aa672 - refactor: HookProvider also belongs to another package
- src/PluginHeaderParser.php 0 → 100644
97 * Searches for metadata in the first 8 KB of a file, such as a plugin or theme. 98 * Each piece of metadata must be on its own line. Fields can not span multiple 99 * lines, the value will get cut at the end of the first line. 100 * If the file data is not within that first 8 KB, then the author should correct 101 * their plugin file and move the data headers to the top. 102 * 103 * @link https://codex.wordpress.org/File_Header 104 * @since 2.9.0 105 * 106 * @param string $file Absolute path to the file. 107 * @param array $default_headers List of headers, in the format `array( 'HeaderKey' => 'Header 108 * Name' )`. 109 * 110 * @return string[] Array of file header values keyed by header name. 111 */ 112 private function get_file_data( string $file, array $default_headers ): array { a czemu nie wykorzystujesz funkcji WP do tego? https://developer.wordpress.org/reference/functions/get_plugin_data/
Bo nie chcę zależeć od WP -- ta funkcja ma być wywoływana także w CI, gdzie nie będziesz mieć dostępu do WordPressa, stąd staram się nie wywoływać żadnych funkcji WP, tylko je replikować.
Jedyne miejsce, gdzie można korzystać z funkcji WP to klasa
Plugin
, cała reszta powinna być odseparowana.changed this line in version 5 of the diff
- src/PluginHeaderParser.php 0 → 100644
77 78 $plugin_data = $this->get_file_data( $plugin_file, self::HEADERS ); 79 80 if ( isset( $plugin_data['Network'] ) ) { 81 $plugin_data['Network'] = filter_var( $plugin_data['Network'], \FILTER_VALIDATE_BOOLEAN ); 82 } 83 84 // If no text domain is defined fall back to the plugin slug. 85 if ( empty( $plugin_data['TextDomain'] ) ) { 86 $plugin_slug = dirname( $plugin_file ); 87 if ( '.' !== $plugin_slug && false === strpos( $plugin_slug, '/' ) ) { 88 $plugin_data['TextDomain'] = $plugin_slug; 89 } 90 } 91 92 return $plugin_data; changed this line in version 5 of the diff
requested review from @dyszczo
added 6 commits
- 7c9cbd7c - chore: add editorconfig
- 802ec7a5 - fix: passthrough container definitions argument
- c33be8d9 - fix: use absolute cache path
- 4899cf32 - fix: don't use hook and global variable
- de695980 - refactor: remove method, which can be replaced with get_path
- 9786f20f - refactor: reorder definition loading, change config key name
Toggle commit listadded 1 commit
- 64a0769a - feat: add hook driver backward compatible with wp-builder
added 2 commits