dns_prefetch() public static method

Stores and prints out domains to prefetch for page speed optimization.
public static dns_prefetch ( mixed $new_urls = null )
$new_urls mixed
Exemplo n.º 1
0
<?php

/**
 * Module Name: VideoPress
 * Module Description: Powerful, simple video hosting for WordPress
 * First Introduced: 2.5
 * Free: false
 * Requires Connection: Yes
 * Sort Order: 27
 * Module Tags: Photos and Videos
 * Feature: Writing
 * Additional Search Queries: video, videos, videopress
 */
Jetpack::dns_prefetch(array('//v0.wordpress.com'));
/**
 * We won't have any videos less than sixty pixels wide. That would be silly.
 */
define('VIDEOPRESS_MIN_WIDTH', 60);
include_once dirname(__FILE__) . '/videopress/utility-functions.php';
include_once dirname(__FILE__) . '/videopress/shortcode.php';
include_once dirname(__FILE__) . '/videopress/videopress.php';
Exemplo n.º 2
0
<?php

/**
 * Module Name: Likes
 * Module Description: Give visitors an easy way to show their appreciation for your content.
 * First Introduced: 2.2
 * Sort Order: 23
 * Requires Connection: Yes
 * Auto Activate: No
 * Module Tags: Social
 */
Jetpack::dns_prefetch(array('//widgets.wp.com', '//s0.wp.com', '//0.gravatar.com', '//1.gravatar.com', '//2.gravatar.com'));
class Jetpack_Likes
{
    public $version = '20141028';
    public static function init()
    {
        static $instance = NULL;
        if (!$instance) {
            $instance = new Jetpack_Likes();
        }
        return $instance;
    }
    function __construct()
    {
        $this->in_jetpack = defined('IS_WPCOM') && IS_WPCOM ? false : true;
        add_action('init', array(&$this, 'action_init'));
        add_action('admin_init', array($this, 'admin_init'));
        if ($this->in_jetpack) {
            add_action('jetpack_activate_module_likes', array($this, 'maybe_sync_content'));
            add_action('jetpack_activate_module_likes', array($this, 'module_toggle'));
Exemplo n.º 3
0
<?php

/**
 * Module Name: Photon
 * Module Description: Speed up images and photos.
 * Jumpstart Description: Mirrors and serves your images from our free and fast image CDN, improving your site’s performance with no additional load on your servers.
 * Sort Order: 25
 * Recommendation Order: 1
 * First Introduced: 2.0
 * Requires Connection: Yes
 * Auto Activate: No
 * Module Tags: Photos and Videos, Appearance, Recommended
 * Feature: Recommended, Jumpstart, Appearance
 * Additional Search Queries: photon, image, cdn, performance, speed
 */
Jetpack::dns_prefetch(array('//i0.wp.com', '//i1.wp.com', '//i2.wp.com'));
Jetpack_Photon::instance();
Exemplo n.º 4
0
 /**
  * @author georgestephanis
  * @covers Jetpack::dns_prefetch
  * @since 3.3.0
  */
 public function test_dns_prefetch()
 {
     // Purge it for a clean start.
     ob_start();
     Jetpack::dns_prefetch();
     ob_end_clean();
     Jetpack::dns_prefetch('http://example1.com/');
     Jetpack::dns_prefetch(array('http://example2.com/', 'https://example3.com'));
     Jetpack::dns_prefetch('https://example2.com');
     $expected = "\r\n" . "<link rel='dns-prefetch' href='//example1.com'>\r\n" . "<link rel='dns-prefetch' href='//example2.com'>\r\n" . "<link rel='dns-prefetch' href='//example3.com'>\r\n";
     $this->assertEquals($expected, get_echo(array('Jetpack', 'dns_prefetch')));
 }
Exemplo n.º 5
0
<?php

/**
 * Module Name: Jetpack Comments
 * Module Description: Let readers comment with WordPress.com, Twitter, Facebook, or Google+ accounts.
 * First Introduced: 1.4
 * Sort Order: 20
 * Requires Connection: Yes
 * Auto Activate: No
 * Module Tags: Social
 */
require dirname(__FILE__) . '/comments/comments.php';
if (is_admin()) {
    require dirname(__FILE__) . '/comments/admin.php';
}
Jetpack_Sync::sync_options(__FILE__, 'comment_registration', 'require_name_email', 'show_avatars', 'avatar_default', 'highlander_comment_form_prompt', 'jetpack_comment_form_color_scheme');
function jetpack_comments_load()
{
    Jetpack::enable_module_configurable(__FILE__);
    Jetpack::module_configuration_load(__FILE__, 'jetpack_comments_configuration_load');
}
function jetpack_comments_configuration_load()
{
    wp_safe_redirect(admin_url('options-discussion.php#jetpack-comments-settings'));
    exit;
}
add_action('jetpack_modules_loaded', 'jetpack_comments_load');
Jetpack::dns_prefetch(array('//jetpack.wordpress.com', '//s0.wp.com', '//s1.wp.com', '//s2.wp.com', '//public-api.wordpress.com', '//0.gravatar.com', '//1.gravatar.com', '//2.gravatar.com'));
Exemplo n.º 6
0
 /**
  * @author georgestephanis
  * @covers Jetpack::dns_prefetch
  * @since 3.3.0
  */
 public function test_dns_prefetch()
 {
     // Save URLs that are already in to remove them later and perform a clean test.
     ob_start();
     Jetpack::dns_prefetch();
     $remove_this = ob_get_clean();
     Jetpack::dns_prefetch('http://example1.com/');
     Jetpack::dns_prefetch(array('http://example2.com/', 'https://example3.com'));
     Jetpack::dns_prefetch('https://example2.com');
     $expected = "\r\n" . "<link rel='dns-prefetch' href='//example1.com'>\r\n" . "<link rel='dns-prefetch' href='//example2.com'>\r\n" . "<link rel='dns-prefetch' href='//example3.com'>\r\n";
     $this->assertEquals($expected, str_replace($remove_this, "\r\n", get_echo(array('Jetpack', 'dns_prefetch'))));
 }