本文整理汇总了PHP中Jetpack::dns_prefetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Jetpack::dns_prefetch方法的具体用法?PHP Jetpack::dns_prefetch怎么用?PHP Jetpack::dns_prefetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jetpack
的用法示例。
在下文中一共展示了Jetpack::dns_prefetch方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?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';
示例2: init
<?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'));
示例3:
<?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();
示例4: test_dns_prefetch
/**
* @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')));
}
示例5: dirname
<?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'));
示例6: test_dns_prefetch
/**
* @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'))));
}