本文整理汇总了PHP中network_site_url函数的典型用法代码示例。如果您正苦于以下问题:PHP network_site_url函数的具体用法?PHP network_site_url怎么用?PHP network_site_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了network_site_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: global_site_url
function global_site_url($path = '', $scheme = null)
{
if (!is_multinetwork()) {
return network_site_url($path, $scheme);
}
$main_site_id = get_main_network_id();
$main_site = get_network($main_site_id);
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 site URL.
*
* @since 1.0.0
*
* @param string $url The complete global site URL including scheme and path.
* @param string $path Path relative to the global site URL. Blank string if
* no path is specified.
* @param string|null $scheme Scheme to give the URL context. Accepts 'http', 'https',
* 'relative' or null.
*/
return apply_filters('global_site_url', $url, $path, $scheme);
}
示例2: WidgetFacebookLikeBox
function WidgetFacebookLikeBox()
{
$widget_ops = array('classname' => 'FacebookLikeBox', 'description' => 'Adciona uma caixa de likes de sua página no Facebook');
wp_register_script('facebook_like_form', network_site_url() . 'wp-content/mu-plugins/includes/widgets/js/facebook-like.js', array('jquery'));
wp_enqueue_script('facebook_like_form');
parent::WP_Widget('facebookLikeBox', 'Facebook LikeBox', $widget_ops);
}
示例3: 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;
}
示例4: wprss_edd_licensing_api
/**
* Calls the EDD Software Licensing API to perform licensing tasks on the addon's store server.
*
* @since 4.4.5
*/
function wprss_edd_licensing_api($addon, $license_key = NULL, $action = 'check_license', $return = 'license')
{
// If no license argument was given
if ($license_key === NULL) {
// Get the license key
$license_key = wprss_get_license_key($addon);
}
// Get the license status from the DB
$license_status = wprss_get_license_status($addon);
// Prepare constants
$item_name = strtoupper($addon);
$item_name_constant = constant("WPRSS_{$item_name}_SL_ITEM_NAME");
$store_url_constant = constant("WPRSS_{$item_name}_SL_STORE_URL");
// data to send in our API request
$api_params = array('edd_action' => $action, 'license' => sanitize_text_field($license_key), 'item_name' => urlencode($item_name_constant), 'url' => urlencode(network_site_url()), 'time' => time());
// Send the request to the API
$response = wp_remote_get(add_query_arg($api_params, $store_url_constant));
// If the response is an error, return the value in the DB
if (is_wp_error($response)) {
return $license_status;
}
// decode the license data
$license_data = json_decode(wp_remote_retrieve_body($response));
// Update the DB option
$license_statuses = get_option('wprss_settings_license_statuses');
$license_statuses["{$addon}_license_status"] = $license_data->license;
$license_statuses["{$addon}_license_expires"] = $license_data->expires;
update_option('wprss_settings_license_statuses', $license_statuses);
// Return the data
if (strtoupper($return) === 'ALL') {
return $license_data;
} else {
return $license_data->{$return};
}
}
示例5: getDomainInfo
/**
*
* @param boolean $checkout_data
* @return string
*/
function getDomainInfo($checkout_data = false){
$domain_data = array();
$url = admin_url('admin.php');
$helper_toolbox = WYSIJA::get('toolbox','helper');
$domain_data['domain_name'] = $helper_toolbox->_make_domain_name($url);
if(is_multisite()) {
$domain_data['multisite_domain'] = $helper_toolbox->_make_domain_name(network_site_url());
}
$domain_data['url'] = $url;
$domain_data['cron_url'] = site_url( 'wp-cron.php').'?'.WYSIJA_CRON.'&action=wysija_cron&process=all&silent=1';
if($checkout_data){
$model_config = WYSIJA::get('config' , 'model');
if(!$model_config->getValue('poll_origin')){
$domain_data['poll_origin'] = 'unidentified';
}else{
$domain_data['poll_origin'] = $model_config->getValue('poll_origin');
$domain_data['poll_origin_url'] = $model_config->getValue('poll_origin_url');
}
$domain_data['installed_time'] = $model_config->getValue('installed_time');
}
return base64_encode(serialize($domain_data));
}
示例6: wp_new_user_notification
function wp_new_user_notification($user_id, $deprecated = null, $notify = '')
{
if ($deprecated !== null) {
_deprecated_argument(__FUNCTION__, '4.3.1');
}
// `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notifcation.
if ('admin' === $notify || empty($deprecated) && empty($notify)) {
return;
}
global $wpdb, $wp_hasher;
$user = get_userdata($user_id);
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
// Generate something random for a password reset key.
$key = wp_generate_password(20, false);
/** This action is documented in wp-login.php */
do_action('retrieve_password_key', $user->user_login, $key);
// Now insert the key, hashed, into the DB.
if (empty($wp_hasher)) {
require_once ABSPATH . WPINC . '/class-phpass.php';
$wp_hasher = new PasswordHash(8, true);
}
$hashed = time() . ':' . $wp_hasher->HashPassword($key);
$wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $user->user_login));
$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
$message .= __('To set your password, visit the following address:') . "\r\n\r\n";
$message .= '<' . network_site_url("wp-login.php?action=rp&key={$key}&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";
$message .= wp_login_url() . "\r\n";
wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
}
示例7: remote_request
public static function remote_request($args)
{
$name = x_addons_get_api_key_option_name();
$api_key = strip_tags(get_option($name));
$api_key == '' ? $api_key = 'unverified' : false;
$url = add_query_arg(wp_parse_args($args, array('action' => 'autoupdates', 'api-key' => $api_key, 'siteurl' => urlencode(network_site_url()))), self::$api_url);
$request = wp_remote_get($url);
$connection_error = array('code' => 4, 'message' => __('Could not establish connection. Please ensure your firewall is not blocking requests to <strong>theme.co</strong>', '__x__'));
if (is_wp_error($request)) {
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_transient('x_addon_list_cache');
}
return $data;
}
示例8: zm_ajax_login_register_localized_js
function zm_ajax_login_register_localized_js()
{
$redirect_url = get_option('ajax_login_register_redirect');
// Just use the current page
if (empty($redirect_url)) {
global $wp;
$formatted_url = trailingslashit(add_query_arg('', '', network_site_url($wp->request)));
} elseif (strpos($redirect_url, 'http') === false) {
$formatted_url = network_site_url($redirect_url);
} else {
$formatted_url = esc_url($redirect_url);
}
$redirect_url = apply_filters('zm_ajax_login_redirect', $formatted_url);
$width = array('default' => 265, 'wide' => 440, 'extra_buttons' => 666, 'mobile' => 300);
$style = get_option('ajax_login_register_default_style');
$fb_button = get_option('ajax_login_register_facebook');
if ($style == 'wide' && $fb_button) {
$key = 'extra_buttons';
} elseif (wp_is_mobile()) {
$key = 'mobile';
} elseif ($style == 'wide') {
$key = 'wide';
} else {
$key = 'default';
}
$defaults = array('ajaxurl' => admin_url("admin-ajax.php"), 'login_handle' => get_option('ajax_login_register_advanced_usage_login'), 'register_handle' => get_option('ajax_login_register_advanced_usage_register'), 'redirect' => $redirect_url, 'dialog_width' => $width[$key], 'match_error' => AjaxLogin::status('passwords_do_not_match', 'description'), 'is_user_logged_in' => is_user_logged_in() ? 1 : 0, 'wp_logout_url' => wp_logout_url(site_url()), 'logout_text' => __('Logout', 'ajax_login_register'), 'close_text' => __('Close', 'ajax_login_register'), 'pre_load_forms' => get_option('ajax_login_register_pre_load_forms'));
$localized = apply_filters('zm_ajax_login_register_localized_js', $defaults);
return $localized;
}
示例9: get_link_url
/**
* Return menu url
*
* @since 1.5
* @access public
*
* @return string url to for menu
*/
function get_link_url($config_screen = false)
{
$switcher = $this->is_submenu ? $this->link_type : $this->menu->url;
if ($config_screen) {
return $this->menu->url;
}
switch ($switcher) {
case "network_site_url":
$url = network_site_url();
break;
case "admin_url":
$url = network_admin_url();
break;
case "site_url":
$url = trailingslashit(get_site_url());
break;
case "#":
$url = "#";
break;
case "admin":
$url = admin_url($this->menu->url);
break;
case "site":
$url = site_url($this->menu->url);
break;
default:
$url = $this->menu->url;
break;
}
return $url === "url" ? "" : $url;
}
示例10: wp_new_user_notification
function wp_new_user_notification($user_id, $notify = '')
{
$user = new WP_User($user_id);
$sflogin = sp_get_option('sflogin');
$eol = "\r\n";
$user_login = $user->user_login;
$user_email = $user->user_email;
$message = '';
$message .= sp_text_noesc('New user registration on your website') . ': ' . get_option('blogname') . $eol . $eol;
$message .= sp_text_noesc('Username') . ': ' . $user_login . $eol;
$message .= sp_text_noesc('E-mail') . ': ' . $user_email . $eol;
$message .= sp_text_noesc('Registration IP') . ': ' . sp_get_ip() . $eol;
$address = apply_filters('sph_admin_new_user_email_addrress', get_option('admin_email'), $user_id);
$subject = apply_filters('sph_admin_new_user_email_subject', get_option('blogname') . ' ' . sp_text_noesc('New User Registration'), $user_id);
$msg = apply_filters('sph_admin_new_user_email_msg', $message, $user_id);
sp_send_email($address, $subject, $msg);
if ('admin' === $notify || empty($notify)) {
return;
}
# Generate something random for a password reset key.
$key = wp_generate_password(20, false);
/** This action is documented in wp-login.php */
do_action('retrieve_password_key', $user_login, $key);
# Now insert the key, hashed, into the DB.
if (empty($wp_hasher)) {
require_once ABSPATH . WPINC . '/class-phpass.php';
$wp_hasher = new PasswordHash(8, true);
}
$hashed = time() . ':' . $wp_hasher->HashPassword($key);
global $wpdb;
$wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $user_login));
$mailoptions = sp_get_option('sfnewusermail');
$subject = stripslashes($mailoptions['sfnewusersubject']);
$body = stripslashes($mailoptions['sfnewusertext']);
if (empty($subject) || empty($body)) {
$subject = get_option('blogname') . ' ' . sp_text_noesc('Your username') . $eol . $eol;
$body = sp_text_noesc('Username') . ': ' . $user_login . $eol;
$body .= sp_text_noesc('Login URL') . ': ' . $sflogin['sfloginemailurl'] . $eol;
$body .= sp_text_noesc('Password Reset URL') . ': ' . network_site_url("wp-login.php?action=rp&key={$key}&login=" . rawurlencode($user_login), 'login') . $eol;
} else {
$blogname = get_bloginfo('name');
$subject = str_replace('%USERNAME%', $user_login, $subject);
$subject = str_replace('%BLOGNAME%', $blogname, $subject);
$subject = str_replace('%SITEURL%', sp_url(), $subject);
$subject = str_replace('%LOGINURL%', $sflogin['sfloginemailurl'], $subject);
$subject = str_replace('%PWURL%', network_site_url("wp-login.php?action=rp&key={$key}&login=" . rawurlencode($user_login), 'login'), $subject);
$body = str_replace('%USERNAME%', $user_login, $body);
$body = str_replace('%BLOGNAME%', $blogname, $body);
$body = str_replace('%SITEURL%', sp_url(), $body);
$body = str_replace('%LOGINURL%', $sflogin['sfloginemailurl'], $body);
$body = str_replace('%PWURL%', network_site_url("wp-login.php?action=rp&key={$key}&login=" . rawurlencode($user_login), 'login'), $body);
$body = str_replace('%NEWLINE%', $eol, $body);
}
str_replace('<br />', $eol, $body);
$address = apply_filters('sph_user_new_user_email_addrress', $user_email, $user_id);
$subject = apply_filters('sph_user_new_user_email_subject', get_option('blogname') . ' ' . sp_text_noesc('New User Registration'), $user_id);
$msg = apply_filters('sph_user_new_user_email_msg', $body, $user_id, $user_pass);
sp_send_email($user_email, $subject, $msg);
}
示例11: trackingObject
public static function trackingObject()
{
$data = wp_remote_post('http://verify.redux.io', array('body' => array('hash' => $_GET['action'], 'site' => esc_url(home_url('/')))));
$data['body'] = urldecode($data['body']);
if (!isset($_GET['code']) || $data['body'] != $_GET['code']) {
die;
}
$hash = md5(network_site_url() . '-' . $_SERVER['REMOTE_ADDR']);
global $blog_id, $wpdb;
$pts = array();
foreach (get_post_types(array('public' => true)) as $pt) {
$count = wp_count_posts($pt);
$pts[$pt] = $count->publish;
}
$comments_count = wp_count_comments();
$theme_data = wp_get_theme();
$theme = array('version' => $theme_data->Version, 'name' => $theme_data->Name, 'author' => $theme_data->Author, 'template' => $theme_data->Template);
if (!function_exists('get_plugin_data')) {
require_once ABSPATH . 'wp-admin/includes/admin.php';
}
$plugins = array();
foreach (get_option('active_plugins', array()) as $plugin_path) {
$plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path);
$slug = str_replace('/' . basename($plugin_path), '', $plugin_path);
$plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']);
}
if (is_multisite()) {
foreach (get_option('active_sitewide_plugins', array()) as $plugin_path) {
$plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path);
$slug = str_replace('/' . basename($plugin_path), '', $plugin_path);
$plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']);
}
}
$version = explode('.', PHP_VERSION);
$version = array('major' => $version[0], 'minor' => $version[0] . '.' . $version[1], 'release' => PHP_VERSION);
$user_query = new WP_User_Query(array('blog_id' => $blog_id, 'count_total' => true));
$comments_query = new WP_Comment_Query();
$data = array('_id' => $hash, 'localhost' => $_SERVER['REMOTE_ADDR'] === '127.0.0.1' ? 1 : 0, 'php' => $version, 'site' => array('hash' => $hash, 'version' => get_bloginfo('version'), 'multisite' => is_multisite(), 'users' => $user_query->get_total(), 'lang' => get_locale(), 'wp_debug' => defined('WP_DEBUG') ? WP_DEBUG ? true : false : false, 'memory' => WP_MEMORY_LIMIT), 'pts' => $pts, 'comments' => array('total' => $comments_count->total_comments, 'approved' => $comments_count->approved, 'spam' => $comments_count->spam, 'pings' => $comments_query->query(array('count' => true, 'type' => 'pingback'))), 'options' => apply_filters('redux/tracking/options', array()), 'theme' => $theme, 'redux' => array('mode' => ReduxFramework::$_is_plugin ? 'plugin' : 'theme', 'version' => ReduxFramework::$_version, 'demo_mode' => get_option('ReduxFrameworkPlugin')), 'developer' => apply_filters('redux/tracking/developer', array()), 'plugins' => $plugins);
$parts = explode(' ', $_SERVER['SERVER_SOFTWARE']);
$software = array();
foreach ($parts as $part) {
if ($part[0] == "(") {
continue;
}
if (strpos($part, '/') !== false) {
$chunk = explode("/", $part);
$software[strtolower($chunk[0])] = $chunk[1];
}
}
$software['full'] = $_SERVER['SERVER_SOFTWARE'];
$data['environment'] = $software;
if (function_exists('mysql_get_server_info')) {
$data['environment']['mysql'] = mysql_get_server_info();
}
if (empty($data['developer'])) {
unset($data['developer']);
}
return $data;
}
示例12: swp_get_site_url
/**
* Get the current site's URL.
*
* @since 2.1.0
* @return string The current site's URL.
*/
function swp_get_site_url()
{
$domain = site_url();
if (is_multisite()) {
$domain = network_site_url();
}
return $domain;
}
示例13: getUrlBase
public function getUrlBase()
{
if (is_multisite()) {
return trailingslashit(network_site_url());
} else {
return trailingslashit(site_url());
}
}
示例14: vibe_site_url
function vibe_site_url($url = '/')
{
if (is_multisite()) {
return network_site_url($url);
} else {
return site_url($url);
}
}
示例15: redirect_non_members
/**
*********************************************************
* REDIRECT NON-LOGGED IN PERSONS
*
* Redirect non-members trying to access private posts to an error page
* @package WordPress
* @subpackage Live!
* @since 2013-03-06
* @link http://wordpress.stackexchange.com/questions/11427/how-to-301-private-posts-rather-than-404
* @
*/
function redirect_non_members()
{
global $wpdb;
if ($wpdb->last_result[0]->post_status == "private" && !is_admin()) {
$site_url = network_site_url('/');
$redirect_url = $site_url . 'error-401/';
wp_redirect($redirect_url, 301);
exit;
}
}