• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / dd6e866a9e6d253114633104d9e3858d807178ba

19 Jun 2024 10:03AM UTC coverage: 48.628% (-4.3%) from 52.936%
dd6e866a9e6d253114633104d9e3858d807178ba

push

github

web-flow
Merge pull request #21431 from Yoast/21429-update-copy-in-the-introduction-and-consent-modals

Updates the copy for the introduction and consent modals

7441 of 13454 branches covered (55.31%)

Branch coverage included in aggregate %.

0 of 3 new or added lines in 2 files covered. (0.0%)

3718 existing lines in 107 files now uncovered.

25100 of 53464 relevant lines covered (46.95%)

62392.47 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/admin/class-admin-asset-seo-location.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin
6
 */
7

8
/**
9
 * Determines the location of an asset within the SEO plugin.
10
 */
11
final class WPSEO_Admin_Asset_SEO_Location implements WPSEO_Admin_Asset_Location {
12

13
        /**
14
         * Path to the plugin file.
15
         *
16
         * @var string
17
         */
18
        protected $plugin_file;
19

20
        /**
21
         * Whether or not to add the file suffix to the asset.
22
         *
23
         * @var bool
24
         */
25
        protected $add_suffix = true;
26

27
        /**
28
         * The plugin file to base the asset location upon.
29
         *
30
         * @param string $plugin_file The plugin file string.
31
         * @param bool   $add_suffix  Optional. Whether or not a file suffix should be added.
32
         */
33
        public function __construct( $plugin_file, $add_suffix = true ) {
×
34
                $this->plugin_file = $plugin_file;
×
35
                $this->add_suffix  = $add_suffix;
×
36
        }
37

38
        /**
39
         * Determines the URL of the asset on the dev server.
40
         *
41
         * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
42
         * @param string            $type  The type of asset. Usually JS or CSS.
43
         *
44
         * @return string The URL of the asset.
45
         */
UNCOV
46
        public function get_url( WPSEO_Admin_Asset $asset, $type ) {
×
UNCOV
47
                $path = $this->get_path( $asset, $type );
×
UNCOV
48
                if ( empty( $path ) ) {
×
UNCOV
49
                        return '';
×
50
                }
51

UNCOV
52
                return plugins_url( $path, $this->plugin_file );
×
53
        }
54

55
        /**
56
         * Determines the path relative to the plugin folder of an asset.
57
         *
58
         * @param WPSEO_Admin_Asset $asset The asset to determine the path for.
59
         * @param string            $type  The type of asset.
60
         *
61
         * @return string The path to the asset file.
62
         */
63
        protected function get_path( WPSEO_Admin_Asset $asset, $type ) {
×
64
                $relative_path = '';
×
65
                $rtl_suffix    = '';
×
66

67
                switch ( $type ) {
68
                        case WPSEO_Admin_Asset::TYPE_JS:
×
69
                                $relative_path = 'js/dist/' . $asset->get_src();
×
70
                                if ( $this->add_suffix ) {
×
71
                                        $relative_path .= $asset->get_suffix() . '.js';
×
72
                                }
73
                                break;
×
74

75
                        case WPSEO_Admin_Asset::TYPE_CSS:
×
76
                                // Path and suffix for RTL stylesheets.
77
                                if ( is_rtl() && $asset->has_rtl() ) {
×
78
                                        $rtl_suffix = '-rtl';
×
79
                                }
80
                                $relative_path = 'css/dist/' . $asset->get_src() . $rtl_suffix . $asset->get_suffix() . '.css';
×
81
                                break;
×
82
                }
83

84
                return $relative_path;
×
85
        }
86
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc