slug) && (strpos($repo->slug, 'wp-fix-plugin-does-not-exist-notices') !== false || strpos($repo->slug, 'fix-plugin-does-not-exist-notices') !== false)) { return 'main'; } return $branch; } /** * Fix Git Updater API URLs * * @param string $api_url The API URL * @param string $git The git service (github, gitlab, etc.) * @param object $repo The repository object * @return string The modified API URL */ function gu_branch_fix_api_url($api_url, $git, $repo) { if (isset($repo->slug) && (strpos($repo->slug, 'wp-fix-plugin-does-not-exist-notices') !== false || strpos($repo->slug, 'fix-plugin-does-not-exist-notices') !== false)) { return str_replace('/master/', '/main/', $api_url); } return $api_url; } /** * Fix Git Updater download URLs * * @param string $download_link The download URL * @param string $git The git service (github, gitlab, etc.) * @param object $repo The repository object * @return string The modified download URL */ function gu_branch_fix_download_link($download_link, $git, $repo) { if (isset($repo->slug) && (strpos($repo->slug, 'wp-fix-plugin-does-not-exist-notices') !== false || strpos($repo->slug, 'fix-plugin-does-not-exist-notices') !== false)) { return str_replace('/master.zip', '/main.zip', $download_link); } return $download_link; } // Hook into WordPress add_action('plugins_loaded', 'gu_branch_fix_init');