| @@ -33,9 +33,9 @@ | ||
| 33 | 33 | // Get the file path. |
| 34 | 34 | $file_path = get_force_refresh_plugin_directory() . $path; |
| 35 | 35 | // If the file doesn't exist, throw an error. |
| 36 | 36 | if ( ! file_exists( $file_path ) ) { |
| 37 | - print_error( "${path} is missing." ); | |
| 37 | + print_error( "{$path} is missing." ); | |
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // Get the file version. |
| @@ -75,9 +75,9 @@ | ||
| 75 | 75 | // Get the file path. |
| 76 | 76 | $file_path = get_force_refresh_plugin_directory() . $path; |
| 77 | 77 | // If the file doesn't exist, throw an error. |
| 78 | 78 | if ( ! file_exists( $file_path ) ) { |
| 79 | - print_error( "${path} is missing." ); | |
| 79 | + print_error( "{$path} is missing." ); | |
| 80 | 80 | return; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // Get the file version. |
| @@ -120,13 +120,30 @@ | ||
| 120 | 120 | return $plugin_url; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | - * Function to conditionally log data based if WP_DEBUG is set. | |
| 124 | + * Gets the current plugin data from the main plugin file. | |
| 125 | 125 | * |
| 126 | + * @return array The plugin data. | |
| 127 | + */ | |
| 128 | +function get_force_refresh_plugin_data(): array { | |
| 129 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 130 | + return get_plugin_data( get_main_plugin_file() ); | |
| 131 | +} | |
| 132 | + | |
| 133 | +/** | |
| 134 | + * Get the current WordPress version. | |
| 135 | + * | |
| 136 | + * @return string | |
| 137 | + */ | |
| 138 | +function get_wordpress_version(): string { | |
| 139 | + return (string) get_bloginfo( 'version' ); | |
| 140 | +} | |
| 141 | + | |
| 142 | +/** | |
| 143 | + * Function to conditionally log data if WP_DEBUG is set. | |
| 144 | + * | |
| 126 | 145 | * @param mixed $log The data to log. |
| 127 | - * | |
| 128 | - * @return void | |
| 129 | 146 | */ |
| 130 | 147 | function logger( $log ): void { |
| 131 | 148 | if ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) { |
| 132 | 149 | // phpcs:disable WordPress.PHP.DevelopmentFunctions |