| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | * Constant used to identify file type as a JS file. |
| 15 | 15 | * |
| 16 | 16 | * @var string |
| 17 | 17 | */ |
| 18 | - const TYPE_JS = 'js'; | |
| 18 | + public const TYPE_JS = 'js'; | |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Constant used to identify file type as a CSS file. |
| 22 | 22 | * |
| @@ -21,9 +21,9 @@ | ||
| 21 | 21 | * Constant used to identify file type as a CSS file. |
| 22 | 22 | * |
| 23 | 23 | * @var string |
| 24 | 24 | */ |
| 25 | - const TYPE_CSS = 'css'; | |
| 25 | + public const TYPE_CSS = 'css'; | |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * The name option identifier. |
| 29 | 29 | * |
| @@ -28,9 +28,9 @@ | ||
| 28 | 28 | * The name option identifier. |
| 29 | 29 | * |
| 30 | 30 | * @var string |
| 31 | 31 | */ |
| 32 | - const NAME = 'name'; | |
| 32 | + public const NAME = 'name'; | |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * The source option identifier. |
| 36 | 36 | * |
| @@ -35,9 +35,9 @@ | ||
| 35 | 35 | * The source option identifier. |
| 36 | 36 | * |
| 37 | 37 | * @var string |
| 38 | 38 | */ |
| 39 | - const SRC = 'src'; | |
| 39 | + public const SRC = 'src'; | |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * The dependencies option identifier. |
| 43 | 43 | * |
| @@ -42,9 +42,9 @@ | ||
| 42 | 42 | * The dependencies option identifier. |
| 43 | 43 | * |
| 44 | 44 | * @var string |
| 45 | 45 | */ |
| 46 | - const DEPS = 'deps'; | |
| 46 | + public const DEPS = 'deps'; | |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * The version option identifier. |
| 50 | 50 | * |
| @@ -49,9 +49,9 @@ | ||
| 49 | 49 | * The version option identifier. |
| 50 | 50 | * |
| 51 | 51 | * @var string |
| 52 | 52 | */ |
| 53 | - const VERSION = 'version'; | |
| 53 | + public const VERSION = 'version'; | |
| 54 | 54 | |
| 55 | 55 | /* Style specific. */ |
| 56 | 56 | |
| 57 | 57 | /** |
| @@ -58,9 +58,9 @@ | ||
| 58 | 58 | * The media option identifier. |
| 59 | 59 | * |
| 60 | 60 | * @var string |
| 61 | 61 | */ |
| 62 | - const MEDIA = 'media'; | |
| 62 | + public const MEDIA = 'media'; | |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * The rtl option identifier. |
| 66 | 66 | * |
| @@ -65,9 +65,9 @@ | ||
| 65 | 65 | * The rtl option identifier. |
| 66 | 66 | * |
| 67 | 67 | * @var string |
| 68 | 68 | */ |
| 69 | - const RTL = 'rtl'; | |
| 69 | + public const RTL = 'rtl'; | |
| 70 | 70 | |
| 71 | 71 | /* Script specific. */ |
| 72 | 72 | |
| 73 | 73 | /** |
| @@ -74,9 +74,9 @@ | ||
| 74 | 74 | * The "in footer" option identifier. |
| 75 | 75 | * |
| 76 | 76 | * @var string |
| 77 | 77 | */ |
| 78 | - const IN_FOOTER = 'in_footer'; | |
| 78 | + public const IN_FOOTER = 'in_footer'; | |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * Asset identifier. |
| 82 | 82 | * |
| @@ -121,8 +121,15 @@ | ||
| 121 | 121 | */ |
| 122 | 122 | protected $in_footer; |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | + * For JS Assets. The script's async/defer strategy. | |
| 126 | + * | |
| 127 | + * @var string | |
| 128 | + */ | |
| 129 | + protected $strategy; | |
| 130 | + | |
| 131 | + /** | |
| 125 | 132 | * For CSS Assets. Whether this stylesheet is a right-to-left stylesheet. |
| 126 | 133 | * |
| 127 | 134 | * @var bool |
| 128 | 135 | */ |
| @@ -146,8 +153,9 @@ | ||
| 146 | 153 | 'rtl' => true, |
| 147 | 154 | 'media' => 'all', |
| 148 | 155 | 'version' => '', |
| 149 | 156 | 'suffix' => '', |
| 157 | + 'strategy' => '', | |
| 150 | 158 | ]; |
| 151 | 159 | |
| 152 | 160 | /** |
| 153 | 161 | * Constructs an instance of the WPSEO_Admin_Asset class. |
| @@ -172,8 +180,9 @@ | ||
| 172 | 180 | $this->deps = $args['deps']; |
| 173 | 181 | $this->version = $args['version']; |
| 174 | 182 | $this->media = $args['media']; |
| 175 | 183 | $this->in_footer = $args['in_footer']; |
| 184 | + $this->strategy = $args['strategy']; | |
| 176 | 185 | $this->rtl = $args['rtl']; |
| 177 | 186 | $this->suffix = $args['suffix']; |
| 178 | 187 | } |
| 179 | 188 | |
| @@ -232,8 +241,17 @@ | ||
| 232 | 241 | * @return bool |
| 233 | 242 | */ |
| 234 | 243 | public function is_in_footer() { |
| 235 | 244 | return $this->in_footer; |
| 245 | + } | |
| 246 | + | |
| 247 | + /** | |
| 248 | + * Returns the script asset's async/defer loading strategy. | |
| 249 | + * | |
| 250 | + * @return string | |
| 251 | + */ | |
| 252 | + public function get_strategy() { | |
| 253 | + return $this->strategy; | |
| 236 | 254 | } |
| 237 | 255 | |
| 238 | 256 | /** |
| 239 | 257 | * Returns whether this CSS has a RTL counterpart. |