Skip to content
Snippets Groups Projects

Draft: Basic implementation of plugin initializer

Closed Bartek Jaskulski requested to merge 1.x into review
2 unresolved threads

Signed-off-by: Bart Jaskulski bjaskulski@protonmail.com

Merge request reports

Approval is optional

Closed by Bartek JaskulskiBartek Jaskulski 1 year ago (Mar 8, 2024 2:27pm UTC)

Merge details

  • The changes were not merged into review.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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 {
  • 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;
  • Krzysztof Dyszczyk requested review from @dyszczo

    requested review from @dyszczo

  • Bartek Jaskulski added 3 commits

    added 3 commits

    • 182e8447 - feat: add VERY simple command to cache plugin data
    • 3b388b3a - refactor: rename header parser implementation
    • b6d626a4 - refactor: simplify package

    Compare with previous version

  • Bartek Jaskulski added 3 commits

    added 3 commits

    • d28fee48 - refactor: remove unused tests
    • b51f058a - chore: add static analysis
    • 8c70cdd4 - feat: add initial bindings for wp-builder compatibility

    Compare with previous version

  • Bartek Jaskulski added 6 commits

    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

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 64a0769a - feat: add hook driver backward compatible with wp-builder

    Compare with previous version

  • added 1 commit

    • 7d9521c6 - fix: throw exception on failed load

    Compare with previous version

  • added 1 commit

    • b77de519 - feat: add check for optional package

    Compare with previous version

  • Bartek Jaskulski added 2 commits

    added 2 commits

    • 4914f07a - chore: add config files
    • 9a91616d - feat: large rework, needs followup

    Compare with previous version

  • Please register or sign in to reply
    Loading