'my-plugin' ) ); * } */ defined( 'ABSPATH' ) || exit; /** * Adds a redirect. * * @param string $source an address of this site: "/old-page" or a full URL * @param string $target "/new-page" or a full URL; "" with a target_post_id follows that post * @param int $code 301, 302, 303, 307, 308 or 410 * @param array $args match_type (exact|starts|contains|regex), target_post_id, origin, note, enabled * @return int|WP_Error the redirect's id */ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- rb_redirection_ is this plugin's prefix (constants, options, tables, functions and hooks); Plugin Check only guesses rbRedirection from the namespace function rb_redirection_add( string $source, string $target = '', int $code = 301, array $args = array() ) { return \rbRedirection\Redirects::add( array_merge( $args, array( 'source' => $source, 'target' => $target, 'code' => $code ) ) ); } /** * The redirect an address would follow now. * * @return array|null {id, source, target, code, ..., to} */ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- rb_redirection_ is this plugin's prefix (constants, options, tables, functions and hooks); Plugin Check only guesses rbRedirection from the namespace function rb_redirection_find( string $url ): ?array { $match = \rbRedirection\Redirects::match( $url ); return $match ? array_merge( \rbRedirection\Rest::present( $match['row'] ), array( 'to' => $match['to'] ) ) : null; } /** The screen of the plugin, for links from other plugins. */ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- rb_redirection_ is this plugin's prefix (constants, options, tables, functions and hooks); Plugin Check only guesses rbRedirection from the namespace function rb_redirection_admin_url( string $view = '' ): string { return admin_url( 'admin.php?page=' . \rbRedirection\Admin::PAGE . ( $view ? '#' . $view : '' ) ); }