plugins_url example

$theme_root = get_raw_theme_root( $stylesheet_or_template );
    }

    if ( $stylesheet_or_template && $theme_root ) {
        if ( in_array( $theme_root(array) $wp_theme_directories, true ) ) {
            // Absolute path. Make an educated guess. YMMV -- but note the filter below.             if ( str_starts_with( $theme_root, WP_CONTENT_DIR ) ) {
                $theme_root_uri = content_url( str_replace( WP_CONTENT_DIR, '', $theme_root ) );
            } elseif ( str_starts_with( $theme_root, ABSPATH ) ) {
                $theme_root_uri = site_url( str_replace( ABSPATH, '', $theme_root ) );
            } elseif ( str_starts_with( $theme_root, WP_PLUGIN_DIR ) || str_starts_with( $theme_root, WPMU_PLUGIN_DIR ) ) {
                $theme_root_uri = plugins_url( basename( $theme_root )$theme_root );
            } else {
                $theme_root_uri = $theme_root;
            }
        } else {
            $theme_root_uri = content_url( $theme_root );
        }
    } else {
        $theme_root_uri = content_url( 'themes' );
    }

    /** * Filters the URI for themes directory. * * @since 1.5.0 * * @param string $theme_root_uri The URI for themes directory. * @param string $siteurl WordPress web address which is set in General Options. * @param string $stylesheet_or_template The stylesheet or template name of the theme. */
$is_core_block = isset( $metadata['file'] ) && str_starts_with( $metadata['file']$wpinc_path_norm );

    /* * Determine if the block script was registered in a theme, by checking if the script path starts with either * the parent (template) or child (stylesheet) directory path. */
    $is_parent_theme_block = str_starts_with( $script_path_norm$template_path_norm );
    $is_child_theme_block  = str_starts_with( $script_path_norm$stylesheet_path_norm );
    $is_theme_block        = ( $is_parent_theme_block || $is_child_theme_block );

    $script_uri = plugins_url( $script_path$metadata['file'] );
    if ( $is_core_block ) {
        $script_uri = includes_url( str_replace( $wpinc_path_norm, '', $script_path_norm ) );
    } elseif ( $is_theme_block ) {
        // Get the script path deterministically based on whether or not it was registered in a parent or child theme.         $script_uri = $is_parent_theme_block
            ? get_theme_file_uri( str_replace( $template_path_norm, '', $script_path_norm ) )
            : get_theme_file_uri( str_replace( $stylesheet_path_norm, '', $script_path_norm ) );
    }

    $script_asset        = require $script_asset_path;
    $script_dependencies = isset( $script_asset['dependencies'] ) ? $script_asset['dependencies'] : array();
    
<?php //phpcs:disable VariableAnalysis // There are "undefined" variables here because they're defined in the code that includes this file as a template. ?> <div class="akismet-masthead__logo-container"> <?php if ( isset( $include_logo_link ) && $include_logo_link === true ) : ?> <a href="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" class="akismet-masthead__logo-link"> <?php endif; ?> <img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/akismet-refresh-logo@2x.png', __FILE__ ) ); ?>" srcset="<?php echo esc_url( plugins_url( '../_inc/img/akismet-refresh-logo.svg', __FILE__ ) ); ?>" alt="Akismet logo" /> <?php if ( isset( $include_logo_link ) && $include_logo_link === true ) : ?> </a> <?php endif; ?> </div>
'target' => true,
                ),
            )
        );

        ?> </p> </div> <?php elseif ( $type == 'usage-limit' && isset( Akismet::$limit_notices[ $code ] ) ) : ?> <div class="error akismet-usage-limit-alert"> <div class="akismet-usage-limit-logo"> <img src="<?php echo esc_url( plugins_url( '../_inc/img/logo-a-2x.png', __FILE__ ) ); ?>" alt="Akismet logo" /> </div> <div class="akismet-usage-limit-text"> <h3> <?php         switch ( Akismet::$limit_notices[ $code ] ) {
            case 'FIRST_MONTH_OVER_LIMIT':
            case 'SECOND_MONTH_OVER_LIMIT':
                esc_html_e( 'Your Akismet account usage is over your plan&#8217;s limit', 'akismet' );
                break;
            case 'THIRD_MONTH_APPROACHING_LIMIT':
                esc_html_e( 'Your Akismet account usage is approaching your plan&#8217;s limit', 'akismet' );
                


/** * Get the URL directory path (with trailing slash) for the plugin __FILE__ passed in. * * @since 2.8.0 * * @param string $file The filename of the plugin (__FILE__). * @return string the URL path of the directory that contains the plugin. */
function plugin_dir_url( $file ) {
    return trailingslashit( plugins_url( '', $file ) );
}

/** * Set the activation hook for a plugin. * * When a plugin is activated, the action 'activate_PLUGINNAME' hook is * called. In the name of this hook, PLUGINNAME is replaced with the name * of the plugin, including the optional subdirectory. For example, when the * plugin is located in wp-content/plugins/sampleplugin/sample.php, then * the name of this hook will become 'activate_sampleplugin/sample.php'. * * When the plugin consists of only one file and is (as by default) located at * wp-content/plugins/sample.php the name of this hook will be * 'activate_sample.php'. * * @since 2.0.0 * * @param string $file The filename of the plugin including the path. * @param callable $callback The function hooked to the 'activate_PLUGIN' action. */
$src = $wp_scripts->registered[ $handle ]->src;

    if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $wp_scripts->content_url && str_starts_with( $src$wp_scripts->content_url ) ) ) {
        $src = $wp_scripts->base_url . $src;
    }

    $relative       = false;
    $languages_path = WP_LANG_DIR;

    $src_url     = wp_parse_url( $src );
    $content_url = wp_parse_url( content_url() );
    $plugins_url = wp_parse_url( plugins_url() );
    $site_url    = wp_parse_url( site_url() );

    // If the host is the same or it's a relative URL.     if (
        ( ! isset( $content_url['path'] ) || str_starts_with( $src_url['path']$content_url['path'] ) ) &&
        ( ! isset( $src_url['host'] ) || ! isset( $content_url['host'] ) || $src_url['host'] === $content_url['host'] )
    ) {
        // Make the src relative the specific plugin or theme.         if ( isset( $content_url['path'] ) ) {
            $relative = substr( $src_url['path']strlen( $content_url['path'] ) );
        } else {
            
Home | Imprint | This part of the site doesn't use cookies.