PluginProbe
Powerkit – Supercharge your WordPress Site / 2.8.3
Powerkit – Supercharge your WordPress Site v2.8.3
3.1.1 3.1.0 3.0.9 3.0.8 trunk 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 All 87 releases
← All changes | core/class-powerkit.php +95 -10 2.3.02.8.3 View file →
@@ -92,9 +92,10 @@
92 92 add_action( 'amp_post_template_css', array( $this, 'amp_enqueue_styles' ) );
93 93 add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 5 );
94 94 add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 5 );
95 95 add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ) );
96 - add_action( 'wp_head', array( $this, 'wp_head' ), 5 );
96 + add_filter( 'style_loader_tag', array( $this, 'style_loader_tag' ), 10, 2 );
97 + add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 );
97 98 }
98 99
99 100 /**
100 101 * This function will safely define a constant
@@ -202,9 +203,9 @@
202 203 *
203 204 * @since 1.0.0
204 205 */
205 206 public function amp_enqueue_styles() {
206 - echo file_get_contents( POWERKIT_PATH . 'assets/css/amp.css' ); // XSS.
207 + powerkit_amp_style( POWERKIT_PATH . 'assets/css/amp.css' );
207 208 }
208 209
209 210 /**
210 211 * This function will register scripts and styles for admin dashboard.
@@ -225,13 +226,28 @@
225 226 }
226 227
227 228 wp_enqueue_script( 'powerkit', POWERKIT_URL . 'assets/js/_scripts.js', array( 'jquery', 'tippy' ), powerkit_get_setting( 'version' ), true );
228 229
230 + // Icons.
231 + wp_enqueue_style( 'powerkit-icons', POWERKIT_URL . 'assets/fonts/powerkit-icons.woff', array(), powerkit_get_setting( 'version' ) );
232 + wp_style_add_data( 'powerkit-icons', 'alt', 'alternate' );
233 +
229 234 // Styles.
230 235 wp_enqueue_style( 'powerkit', powerkit_style( POWERKIT_URL . 'assets/css/powerkit.css' ), array(), powerkit_get_setting( 'version' ) );
236 + wp_style_add_data( 'powerkit', 'rtl', 'replace' );
237 + }
231 238
232 - // Add RTL support.
233 - wp_style_add_data( 'powerkit', 'rtl', 'replace' );
239 + /**
240 + * Filters the HTML link tag of an enqueued style.
241 + *
242 + * @param string $tag The link tag for the enqueued style.
243 + * @param string $handle The style's registered handle.
244 + */
245 + public function style_loader_tag( $tag, $handle ) {
246 + if ( 'powerkit-icons' === $handle ) {
247 + return str_replace( "media='all'", "as='font' type='font/wof' crossorigin", $tag );
248 + }
249 + return $tag;
234 250 }
235 251
236 252 /**
237 253 * Sets up theme defaults and registers support for various WordPress features.
@@ -249,16 +265,85 @@
249 265 }
250 266 }
251 267
252 268 /**
253 - * Fire the wp_head action.
269 + * Filters the HTML that is allowed for a given context.
270 + *
271 + * @param array $tags Tags by.
272 + * @param string $context Context name.
254 273 */
255 - public function wp_head() {
256 - ?>
257 - <link rel="preload" href="<?php echo esc_url( POWERKIT_URL . 'assets/fonts/powerkit-icons.woff' ); ?>" as="font" type="font/woff" crossorigin>
258 - <?php
274 + public function wp_kses_allowed_html( $tags, $context ) {
275 + if ( 'pk-title' === $context ) {
276 + $tags = array(
277 + 'a' => array(
278 + 'class' => true,
279 + 'href' => true,
280 + 'title' => true,
281 + 'target' => true,
282 + 'rel' => true,
283 + ),
284 + 'div' => array(
285 + 'class' => true,
286 + 'id' => true,
287 + 'style' => true,
288 + ),
289 + 'span' => array(
290 + 'class' => true,
291 + 'id' => true,
292 + 'style' => true,
293 + ),
294 + 'img' => array(
295 + 'class' => true,
296 + 'id' => true,
297 + 'src' => true,
298 + 'rel' => true,
299 + 'srcset' => true,
300 + 'size' => true,
301 + ),
302 + 'br' => array(),
303 + 'b' => array(),
304 + 'strong' => array(),
305 + 'i' => array(),
306 + 'p' => array(
307 + 'class' => true,
308 + 'id' => true,
309 + 'style' => true,
310 + ),
311 + 'h1' => array(
312 + 'class' => true,
313 + 'id' => true,
314 + 'style' => true,
315 + ),
316 + 'h2' => array(
317 + 'class' => true,
318 + 'id' => true,
319 + 'style' => true,
320 + ),
321 + 'h3' => array(
322 + 'class' => true,
323 + 'id' => true,
324 + 'style' => true,
325 + ),
326 + 'h4' => array(
327 + 'class' => true,
328 + 'id' => true,
329 + 'style' => true,
330 + ),
331 + 'h5' => array(
332 + 'class' => true,
333 + 'id' => true,
334 + 'style' => true,
335 + ),
336 + 'h6' => array(
337 + 'class' => true,
338 + 'id' => true,
339 + 'style' => true,
340 + ),
341 + );
342 + }
343 +
344 + return $tags;
259 345 }
260 -
261 346 }
262 347
263 348 /**
264 349 * The main function responsible for returning the one true powerkit Instance to functions everywhere.