本文整理汇总了PHP中network_home_url函数的典型用法代码示例。如果您正苦于以下问题:PHP network_home_url函数的具体用法?PHP network_home_url怎么用?PHP network_home_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了network_home_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remote_request
public static function remote_request($args)
{
$name = x_addons_get_api_key_option_name();
$api_key = esc_attr(get_option($name));
if ($api_key == '') {
$api_key = 'unverified';
}
$args = wp_parse_args($args, array('action' => 'autoupdates', 'api-key' => $api_key, 'siteurl' => preg_replace('#(https?:)?//#', '', esc_attr(untrailingslashit(network_home_url()))), 'xversion' => X_VERSION));
$request_url = self::$base_url . trailingslashit($args['action']) . trailingslashit($args['api-key']);
unset($args['action']);
unset($args['api-key']);
$uri = add_query_arg($args, $request_url);
$request = wp_remote_get($uri, array('timeout' => 15));
$connection_error = array('code' => 4, 'message' => __('Could not establish connection. For assistance, please start by reviewing our article on troubleshooting <a href="https://community.theme.co/kb/connection-issues/">connection issues.</a>', '__x__'));
if (is_wp_error($request) || $request['response']['code'] != 200) {
self::store_error($request);
return $connection_error;
}
$data = json_decode($request['body'], true);
if (!isset($data['code'])) {
return $connection_error;
}
//
// Key was good but is now invalid (revoked).
//
if ($api_key != '' && $data['code'] == 3) {
delete_option($name);
delete_site_option('x_addon_list_cache');
}
return $data;
}
示例2: setRulesFilters
public static function setRulesFilters()
{
$home_url = parse_url(is_multisite() ? network_home_url('/') : home_url('/'));
extract($home_url);
self::$rules_filters = ['www\\.example\\.com' => preg_quote($host), 'www.example.com/' => $host . $path, 'www.example.com' => $host, '/wordpress' => parse_url(site_url(), PHP_URL_PATH)];
self::$rules_filters = apply_filters('roots/h5bp-htaccess-filters', self::$rules_filters);
}
示例3: is_multisite_root
function is_multisite_root()
{
if (is_multisite()) {
return trailingslashit(get_home_url()) === trailingslashit(network_home_url()) ? true : false;
}
return true;
}
示例4: global_home_url
function global_home_url($path = '', $scheme = null)
{
if (!is_multinetwork()) {
return network_home_url($path, $scheme);
}
$main_site_id = get_main_network_id();
$main_site = get_network($main_site_id);
$orig_scheme = $scheme;
if (!in_array($scheme, array('http', 'https', 'relative'))) {
$scheme = is_ssl() && !is_admin() ? 'https' : 'http';
}
if ('relative' == $scheme) {
$url = $main_site->path;
} else {
$url = set_url_scheme('http://' . $main_site->domain . $main_site->path, $scheme);
}
if ($path && is_string($path)) {
$url .= ltrim($path, '/');
}
/**
* Filters the global home URL.
*
* @since 1.0.0
*
* @param string $url The complete global home URL including scheme and path.
* @param string $path Path relative to the global home URL. Blank string
* if no path is specified.
* @param string|null $orig_scheme Scheme to give the URL context. Accepts 'http', 'https',
* 'relative' or null.
*/
return apply_filters('global_home_url', $url, $path, $orig_scheme);
}
示例5: filter_body_class
function filter_body_class($classes = array())
{
$return = $classes;
$site_id = 0;
$site_url = network_site_url();
$home_url = network_home_url();
if (is_multisite()) {
$site_id = get_current_blog_id();
}
if (!empty($site_id)) {
$arrReturn = 'site-id-' . $site_id;
}
if ($site_url != $home_url) {
$arrReturn[] = 'site-url-' . $this->sanitize_url_class($site_url);
$arrReturn[] = 'home-url-' . $this->sanitize_url_class($home_url);
} else {
$arrReturn[] = $this->sanitize_url_class($site_url);
}
if (!empty($arrReturn)) {
if (!empty($classes)) {
$return = array_unique($arrReturn + $classes);
} else {
$return = $arrReturn;
}
}
return $return;
}
示例6: set_site_host
function set_site_host()
{
$host = network_home_url();
$host = parse_url($host);
$host = $host['host'];
$host = apply_filters('vp_seo_hide_site_host', $host);
$this->site_host = $host;
}
示例7: wxr_site_url
/**
* Return the URL of the site
*
* @since 2.5.0
*
* @return string Site URL.
*/
function wxr_site_url()
{
// ms: the base url
if (is_multisite()) {
return network_home_url();
} else {
return get_site_url();
}
}
示例8: wcli_wxr_site_url
/**
* Return the URL of the site
*
* @since 2.5.0
*
* @return string Site URL.
*/
function wcli_wxr_site_url()
{
// ms: the base url
if (is_multisite()) {
return network_home_url();
} else {
return get_bloginfo_rss('url');
}
}
示例9: wxr_site_url
/**
* Return the URL of the site
*
* @since 2.5.0
*
* @return string Site URL.
*/
function wxr_site_url()
{
// Multisite: the base URL.
if (is_multisite()) {
return network_home_url();
} else {
return get_bloginfo_rss('url');
}
}
示例10: __construct
/**
* The Constructor function adds the function that pushes published posts to the list, as well as registers the widget.
*/
function __construct()
{
load_plugin_textdomain('hrpn', false, dirname(plugin_basename(__FILE__)) . '/languages');
add_action('publish_post', array($this, 'Add_Post_To_H1_Recent_Posts_From_Network'));
add_action('widgets_init', array($this, 'Register_H1_Recent_Posts_From_Network_Widget'));
$first_post = get_site_option('first_post');
$first_post = str_replace("SITE_URL", esc_url(network_home_url()), $first_post);
$first_post = str_replace("SITE_NAME", get_current_site()->site_name, $first_post);
$this->first_post = $first_post;
}
开发者ID:ZeelandFamily,项目名称:h1-recent-posts-from-network,代码行数:13,代码来源:HerculesRecentPostsfromNetwork.php
示例11: __construct
/**
* @param Delicious_Brains_API_Plugin $plugin
*/
function __construct(Delicious_Brains_API_Plugin $plugin)
{
$this->plugin = $plugin;
$home_url = home_url('', 'http');
if ($this->plugin->is_network_activated) {
// Make sure always use the network URL in API communication
$home_url = network_home_url('', 'http');
}
$this->home_url = untrailingslashit($home_url);
parent::__construct();
}
示例12: get_absolute_file_url
function get_absolute_file_url($url)
{
if (is_multisite()) {
global $blog_id;
$upload_dir = wp_upload_dir();
if (strpos($upload_dir['basedir'], 'blogs.dir') !== false) {
$parts = explode('/files/', $url);
$url = network_home_url() . '/wp-content/blogs.dir/' . $blog_id . '/files/' . $parts[1];
}
}
return $url;
}
示例13: edd_w3edge_w3tc_reset_rooturi
function edd_w3edge_w3tc_reset_rooturi($license, $version)
{
// data to send in our API request
$api_params = array('edd_action' => 'reset_rooturi', 'license_key' => $license, 'home_url' => network_home_url(), 'item_name' => urlencode(EDD_W3EDGE_W3TC_NAME), 'r' => rand(), 'version' => $version);
// Call the custom API.
$response = wp_remote_get(add_query_arg($api_params, EDD_W3EDGE_STORE_URL), array('timeout' => 15, 'sslverify' => false));
if (is_wp_error($response)) {
return false;
}
// decode the license data
$status = json_decode(wp_remote_retrieve_body($response));
return $status;
}
示例14: get_blogaddress_by_name
function get_blogaddress_by_name( $blogname ) {
global $current_site;
if ( is_subdomain_install() ) {
if ( $blogname == 'main' )
$blogname = 'www';
$url = rtrim( network_home_url(), '/' );
if ( !empty( $blogname ) )
$url = preg_replace( '|^([^\.]+://)|', '$1' . $blogname . '.', $url );
} else {
$url = network_home_url( $blogname );
}
return esc_url( $url . '/' );
}
示例15: get_blogaddress_by_name
/**
* Get a full blog URL, given a blog name.
*
* @since MU
*
* @param string $blogname The (subdomain or directory) name
* @return string
*/
function get_blogaddress_by_name($blogname)
{
if (is_subdomain_install()) {
if ($blogname == 'main') {
$blogname = 'www';
}
$url = rtrim(network_home_url(), '/');
if (!empty($blogname)) {
$url = preg_replace('|^([^\\.]+://)|', "\${1}" . $blogname . '.', $url);
}
} else {
$url = network_home_url($blogname);
}
return esc_url($url . '/');
}