本文整理汇总了PHP中set_url_scheme函数的典型用法代码示例。如果您正苦于以下问题:PHP set_url_scheme函数的具体用法?PHP set_url_scheme怎么用?PHP set_url_scheme使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_url_scheme函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rtmedia_image_editor_content
/**
* Add the content for the image editor tab
*
* @global RTMediaQuery $rtmedia_query
*
* @param string $type
*/
function rtmedia_image_editor_content($type = 'photo')
{
global $rtmedia_query;
if (isset($rtmedia_query->media) && is_array($rtmedia_query->media) && isset($rtmedia_query->media[0]->media_type) && 'photo' === $rtmedia_query->media[0]->media_type && 'photo' === $type) {
$media_id = $rtmedia_query->media[0]->media_id;
$id = $rtmedia_query->media[0]->id;
$modify_button = $nonce = '';
if (current_user_can('edit_posts')) {
include_once ABSPATH . 'wp-admin/includes/image-edit.php';
$nonce = wp_create_nonce("image_editor-{$media_id}");
$modify_button = '<p><input type="button" class="button rtmedia-image-edit" id="imgedit-open-btn-' . esc_attr($media_id) . '" onclick="imageEdit.open( \'' . esc_attr($media_id) . '\', \'' . esc_attr($nonce) . '\' )" value="' . esc_attr__('Modify Image', 'buddypress-media') . '"> <span class="spinner"></span></p>';
}
$image_path = rtmedia_image('rt_media_activity_image', $id, false);
echo '<div class="content" id="panel2">';
echo '<div class="rtmedia-image-editor-cotnainer" id="rtmedia-image-editor-cotnainer" >';
echo '<input type="hidden" id="rtmedia-filepath-old" name="rtmedia-filepath-old" value="' . esc_url($image_path) . '" />';
echo '<div class="rtmedia-image-editor" id="image-editor-' . esc_attr($media_id) . '"></div>';
$thumb_url = wp_get_attachment_image_src($media_id, 'thumbnail', true);
echo '<div id="imgedit-response-' . esc_attr($media_id) . '"></div>';
echo '<div class="wp_attachment_image" id="media-head-' . esc_attr($media_id) . '">' . '<p id="thumbnail-head-' . esc_attr($id) . '"><img class="thumbnail" src="' . esc_url(set_url_scheme($thumb_url[0])) . '" alt="" /></p>' . $modify_button . '</div>';
// @codingStandardsIgnoreLine
echo '</div>';
echo '</div>';
}
}
示例2: 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);
}
示例3: ssl_srcset
function ssl_srcset($sources)
{
foreach ($sources as &$source) {
$source['url'] = set_url_scheme($source['url'], 'https');
}
return $sources;
}
示例4: pb_wpapi
/**
* WP API Function
*
* Access information about plugin from the API
*
* @access public
* @param mixed $action
* @param mixed $args (default: null)
* @return string
*/
function pb_wpapi($action, $args = null)
{
if (is_array($args)) {
$args = (object) $args;
}
if (!isset($args->per_page)) {
$args->per_page = 24;
}
// Allows a plugin to override the WordPress.org API entirely.
// Use the filter 'plugins_api_result' to merely add results.
// Please ensure that a object is returned from the following filters.
$args = apply_filters('plugins_api_args', $args, $action);
$res = apply_filters('plugins_api', false, $action, $args);
if (false === $res) {
$url = 'http://api.wordpress.org/plugins/info/1.0/';
if (wp_http_supports(array('ssl'))) {
$url = set_url_scheme($url, 'https');
}
$request = wp_remote_post($url, array('timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))));
if (is_wp_error($request)) {
$res = new WP_Error('plugins_api_failed', __('An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.'), $request->get_error_message());
} else {
$res = maybe_unserialize(wp_remote_retrieve_body($request));
if (!is_object($res) && !is_array($res)) {
$res = new WP_Error('plugins_api_failed', __('An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.'), wp_remote_retrieve_body($request));
}
}
} elseif (!is_wp_error($res)) {
$res->external = true;
}
return apply_filters('plugins_api_result', $res, $action, $args);
}
示例5: zn_logo
function zn_logo($logo = null, $use_transparent = false, $tag = null, $class = null)
{
$transparent_logo = '';
if (!$tag) {
if (is_front_page()) {
$tag = 'h1';
} else {
$tag = 'h3';
}
}
if ('transparent_header' == get_post_meta(zn_get_the_id(), 'header_style', true) && $use_transparent) {
$transparent_logo = zget_option('transparent_logo', 'general_options');
}
if ($logo || ($logo = zget_option('logo', 'general_options'))) {
// TODO: remove this as it is slow withouth the full path
$logo_size = array('300', '100');
//print_z($logo_size);
$hwstring = image_hwstring($logo_size[0], $logo_size[1]);
$logo = '<img class="non-transparent" src="' . set_url_scheme($logo) . '" ' . $hwstring . ' alt="' . get_bloginfo('name') . '" title="' . get_bloginfo('description') . '" />';
if ($transparent_logo && $transparent_logo != ' ') {
$logo .= '<img class="only-transparent" src="' . set_url_scheme($transparent_logo) . '" alt="' . get_bloginfo('name') . '" title="' . get_bloginfo('description') . '" />';
}
$logo = "<{$tag} class='logo {$class}' id='logo'><a href='" . home_url('/') . "'>" . $logo . "</a></{$tag}>";
} else {
$logo = '<img src="' . THEME_BASE_URI . '/images/logo.png" alt="' . get_bloginfo('name') . '" title="' . get_bloginfo('description') . '" />';
$logo = "<{$tag} class='logo {$class}' id='logo'><a href='" . home_url('/') . "'>" . $logo . "</a></{$tag}>";
}
return $logo;
}
示例6: dw_enqueue_scripts
function dw_enqueue_scripts()
{
$version = 1389776043;
wp_enqueue_style('dw-fixel-template', DW_URI . 'assets/css/template.css');
wp_enqueue_style('dw-fixel-style', get_stylesheet_uri());
wp_enqueue_style('font-awesome', DW_URI . 'assets/css/font-awesome.css');
wp_enqueue_style('print', DW_URI . 'assets/css/print.css', false, false, 'print');
wp_enqueue_style('jquery-mcustomScrollbar', DW_URI . 'assets/css/jquery.mCustomScrollbar.css');
wp_enqueue_style('prettify', DW_URI . 'assets/prettyprint/prettify.css');
wp_enqueue_script('plusone', 'https://apis.google.com/js/plusone.js', false, false, true);
wp_enqueue_script('jquery');
wp_enqueue_script('modernizr', DW_URI . 'assets/js/modernizr.js', array('jquery'), $version, true);
wp_enqueue_script('bootstrap', DW_URI . 'assets/js/bootstrap.js', array('jquery'), $version, true);
wp_enqueue_script('masonry', DW_URI . 'assets/js/masonry.js', array('jquery'), $version, true);
//Showmore type on archive page
$show_more_type = dw_get_theme_option('show_more_type', 'infinite');
if ('infinite' == $show_more_type) {
wp_enqueue_script('infinitescroll', DW_URI . 'assets/js/jquery.infinitescroll.min.js', array('jquery'), $version, true);
}
wp_enqueue_script('jquery-mcustomScrollbar', DW_URI . 'assets/js/jquery.mCustomScrollbar.concat.min.js', array('jquery'), $version, true);
wp_enqueue_script('dw-fixel', DW_URI . 'assets/js/main.js', array('jquery', 'modernizr', 'bootstrap', 'masonry'), $version, true);
wp_enqueue_script('prettify', DW_URI . 'assets/prettyprint/prettify.js', false, false, true);
$current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
$current_url = remove_query_arg('paged', $current_url);
$dw = array('ajax_url' => admin_url('admin-ajax.php'), 'current_url' => $current_url, 'is_single' => is_single(), 'site_url' => site_url(), 'theme_url' => DW_URI, 'show_more_type' => $show_more_type);
wp_localize_script('dw-edit-layout', 'dw', $dw);
wp_localize_script('dw-fixel', 'dw', $dw);
if (!is_404() && have_posts() && comments_open()) {
wp_enqueue_script('comment-reply');
}
}
示例7: image_src
function image_src($sources)
{
foreach ($sources as &$source) {
$source['url'] = set_url_scheme($source['url']);
}
return $sources;
}
示例8: admin_queue
public function admin_queue()
{
global $thesis;
if (!empty($_GET['canvas']) && $_GET['canvas'] == 'skin-editor-quicklaunch' && wp_verify_nonce($_GET['_wpnonce'], 'thesis-skin-editor-quicklaunch')) {
wp_redirect(set_url_scheme(home_url('?thesis_editor=1')));
exit;
} else {
$styles = array('thesis-admin' => array('url' => 'admin.css'), 'thesis-home' => array('url' => 'home.css', 'deps' => array('thesis-admin')), 'thesis-options' => array('url' => 'options.css', 'deps' => array('thesis-admin')), 'thesis-objects' => array('url' => 'objects.css', 'deps' => array('thesis-options', 'thesis-popup')), 'thesis-box-form' => array('url' => 'box_form.css', 'deps' => array('thesis-options', 'thesis-popup')), 'thesis-popup' => array('url' => 'popup.css', 'deps' => array('thesis-options')), 'codemirror' => array('url' => 'codemirror.css'));
foreach ($styles as $name => $atts) {
wp_register_style($name, THESIS_CSS_URL . "/{$atts['url']}", !empty($atts['deps']) ? $atts['deps'] : array(), $thesis->version);
}
$scripts = array('thesis-menu' => array('url' => 'menu.js'), 'thesis-options' => array('url' => 'options.js', 'deps' => array('thesis-menu')), 'thesis-objects' => array('url' => 'objects.js', 'deps' => array('thesis-menu')), 'codemirror' => array('url' => 'codemirror.js'));
foreach ($scripts as $name => $atts) {
wp_register_script($name, THESIS_JS_URL . "/{$atts['url']}", !empty($atts['deps']) ? $atts['deps'] : array(), $thesis->version, true);
}
wp_enqueue_style('thesis-admin');
#wp
wp_enqueue_script('thesis-menu');
#wp
if (empty($_GET['canvas'])) {
wp_enqueue_style('thesis-home');
} elseif (in_array($_GET['canvas'], array('system_status', 'license_key'))) {
wp_enqueue_style('thesis-options');
}
}
}
示例9: __construct
function __construct($item)
{
$this->title = $this->cleanup($item->get_title());
$this->date = $item->get_date('U');
$this->description = '';
$data = $item->get_description();
preg_match_all('/<img src="([^"]*)"([^>]*)>/i', $data, $m);
$this->url = set_url_scheme($m[1][0], 'https');
preg_match_all('/<a href="([^"]*)"([^>]*)>/i', $data, $m);
$this->link = $m[1][1];
preg_match_all('/width="([^"]*)"([^>]*)>/i', $data, $m);
$this->width = $m[1][0];
preg_match_all('/height="([^"]*)"([^>]*)>/i', $data, $m);
$this->height = $m[1][0];
$this->orientation = $this->height > $this->width ? "portrait" : "landscape";
if ($enclosure = $item->get_enclosure()) {
$this->original = $enclosure->get_link();
$this->description = html_entity_decode($enclosure->get_description());
if ($thumbs = $enclosure->get_thumbnails()) {
$last = count($thumbs) - 1;
$this->original = $thumbs[$last];
}
}
if (empty($this->description) && preg_match_all('!<p>(.+?)</p>!sim', $data, $m, PREG_PATTERN_ORDER) && is_array($m) && count($m[1]) > 2) {
$this->description = "<p>" . $m[1][2] . "</p>";
}
}
示例10: __construct
function __construct()
{
//add_action( 'init', array($this,'init_addons'));
$this->vc_template_dir = plugin_dir_path(__FILE__) . 'vc_templates/';
$this->vc_dest_dir = get_template_directory() . '/vc_templates/';
$this->module_dir = plugin_dir_path(__FILE__) . 'modules/';
$this->assets_js = plugins_url('assets/js/', __FILE__);
$this->assets_css = plugins_url('assets/css/', __FILE__);
$this->admin_js = plugins_url('admin/js/', __FILE__);
$this->admin_css = plugins_url('admin/css/', __FILE__);
$this->paths = wp_upload_dir();
$this->paths['fonts'] = 'smile_fonts';
$this->paths['fonturl'] = set_url_scheme(trailingslashit($this->paths['baseurl']) . $this->paths['fonts']);
add_action('init', array($this, 'aio_init'));
add_action('admin_enqueue_scripts', array($this, 'aio_admin_scripts'));
add_action('wp_enqueue_scripts', array($this, 'aio_front_scripts'));
add_action('admin_init', array($this, 'toggle_updater'));
if (!get_option('ultimate_row')) {
update_option('ultimate_row', 'enable');
}
if (!get_option('ultimate_animation')) {
update_option('ultimate_animation', 'disable');
}
//add_action('admin_init', array($this, 'aio_move_templates'));
}
示例11: edd_load_scripts
/**
* Load Scripts
*
* Enqueues the required scripts.
*
* @since 1.0
* @global $post
* @return void
*/
function edd_load_scripts()
{
global $post;
$js_dir = EDD_PLUGIN_URL . 'assets/js/';
// Use minified libraries if SCRIPT_DEBUG is turned off
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
// Get position in cart of current download
if (isset($post->ID)) {
$position = edd_get_item_position_in_cart($post->ID);
}
if (edd_is_checkout()) {
if (edd_is_cc_verify_enabled()) {
wp_register_script('creditCardValidator', $js_dir . 'jquery.creditCardValidator' . $suffix . '.js', array('jquery'), EDD_VERSION);
wp_enqueue_script('creditCardValidator');
}
wp_register_script('edd-checkout-global', $js_dir . 'edd-checkout-global' . $suffix . '.js', array('jquery'), EDD_VERSION);
wp_enqueue_script('edd-checkout-global');
wp_localize_script('edd-checkout-global', 'edd_global_vars', apply_filters('edd_global_checkout_script_vars', array('ajaxurl' => edd_get_ajax_url(), 'checkout_nonce' => wp_create_nonce('edd_checkout_nonce'), 'currency_sign' => edd_currency_filter(''), 'currency_pos' => edd_get_option('currency_position', 'before'), 'no_gateway' => __('Please select a payment method', 'edd'), 'no_discount' => __('Please enter a discount code', 'edd'), 'enter_discount' => __('Enter discount', 'edd'), 'discount_applied' => __('Discount Applied', 'edd'), 'no_email' => __('Please enter an email address before applying a discount code', 'edd'), 'no_username' => __('Please enter a username before applying a discount code', 'edd'), 'purchase_loading' => __('Please Wait...', 'edd'), 'complete_purchase' => __('Purchase', 'edd'), 'taxes_enabled' => edd_use_taxes() ? '1' : '0', 'edd_version' => EDD_VERSION)));
}
// Load AJAX scripts, if enabled
if (!edd_is_ajax_disabled()) {
wp_register_script('edd-ajax', $js_dir . 'edd-ajax' . $suffix . '.js', array('jquery'), EDD_VERSION);
wp_enqueue_script('edd-ajax');
wp_localize_script('edd-ajax', 'edd_scripts', apply_filters('edd_ajax_script_vars', array('ajaxurl' => edd_get_ajax_url(), 'position_in_cart' => isset($position) ? $position : -1, 'already_in_cart_message' => __('You have already added this item to your cart', 'edd'), 'empty_cart_message' => __('Your cart is empty', 'edd'), 'loading' => __('Loading', 'edd'), 'select_option' => __('Please select an option', 'edd'), 'ajax_loader' => set_url_scheme(EDD_PLUGIN_URL . 'assets/images/loading.gif', 'relative'), 'is_checkout' => edd_is_checkout() ? '1' : '0', 'default_gateway' => edd_get_default_gateway(), 'redirect_to_checkout' => edd_straight_to_checkout() || edd_is_checkout() ? '1' : '0', 'checkout_page' => edd_get_checkout_uri(), 'permalinks' => get_option('permalink_structure') ? '1' : '0', 'quantities_enabled' => edd_item_quantities_enabled(), 'taxes_enabled' => edd_use_taxes() ? '1' : '0')));
}
}
示例12: audiotheme_less_force_ssl
/**
* Force SSL on LESS cache URLs.
*
* @since 1.3.1
*
* @param string $url URL to compiled CSS.
* @return string
*/
function audiotheme_less_force_ssl($dir)
{
if (is_ssl()) {
$dir = set_url_scheme($dir, 'https');
}
return $dir;
}
示例13: bogo_page_link
function bogo_page_link($permalink, $id, $sample)
{
if (!bogo_is_localizable_post_type('page')) {
return $permalink;
}
$locale = bogo_get_post_locale($id);
$post = get_post($id);
if ('page' == get_option('show_on_front')) {
$front_page_id = get_option('page_on_front');
if ($id == $front_page_id) {
return $permalink;
}
$translations = bogo_get_post_translations($front_page_id);
if (!empty($translations[$locale])) {
if ($translations[$locale]->ID == $id) {
$home = set_url_scheme(get_option('home'));
$home = trailingslashit($home);
return bogo_url($home, $locale);
}
}
}
$permalink_structure = get_option('permalink_structure');
$using_permalinks = $permalink_structure && ($sample || !in_array($post->post_status, array('draft', 'pending', 'auto-draft')));
$permalink = bogo_get_url_with_lang($permalink, $locale, array('using_permalinks' => $using_permalinks));
return $permalink;
}
示例14: AtD_http_post
/**
* Returns array with headers in $response[0] and body in $response[1]
* Based on a function from Akismet
*/
function AtD_http_post($request, $host, $path, $port = 80)
{
$http_args = array('body' => $request, 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), 'Host' => $host, 'User-Agent' => 'AtD/0.1'), 'httpversion' => '1.0', 'timeout' => apply_filters('atd_http_post_timeout', 15));
// Handle non-standard ports being passed in.
if (80 !== $port && is_numeric($port) && intval($port) > 0) {
$host .= ':' . intval($port);
}
// Strip any / off the begining so we can add it back and protect against SSRF
$path = ltrim($path, '/');
$AtD_url = set_url_scheme("http://{$host}/{$path}");
$response = wp_remote_post($AtD_url, $http_args);
$code = (int) wp_remote_retrieve_response_code($response);
if (is_wp_error($response)) {
/**
* Fires when there is a post error to AtD.
*
* @since 1.2.3
*
* @param int|string http-error The error that AtD runs into.
*/
do_action('atd_http_post_error', 'http-error');
return array();
} elseif (200 != $code) {
/** This action is documented in modules/after-the-deadline/proxy.php */
do_action('atd_http_post_error', $code);
}
return array(wp_remote_retrieve_headers($response), wp_remote_retrieve_body($response));
}
示例15: render
public function render()
{
$return = "";
$return .= "<div id=\"" . $this->attributes['container'] . "\" class=\"custom-media-upload hide-if-no-js\">";
$return .= " <span class=\"title\">" . esc_html($this->attributes['label']) . "</span>";
$return .= " <div class=\"customize-control-content\">";
$return .= " <div class=\"dropdown preview-thumbnail\" tabindex=\"0\">";
$return .= " <div class=\"dropdown-content\">";
$return .= " <input id=\"" . $this->attributes['AttachIdInput'] . "\" type=\"hidden\" name=\"" . $this->attributes['AttachIdName'] . "\" />";
$return .= " <input class=\"imgurl\" id=\"" . $this->attributes['input'] . "\" type=\"hidden\" name=\"" . $this->attributes['name'] . "\" value=\"" . $this->attributes['value'] . "\"/>";
if (empty($this->attributes['value'])) {
$return .= " <img id=" . $this->attributes['preview_thumb_id'] . " style=\"display:none;\" />";
} else {
$return .= " <img id=" . $this->attributes['preview_thumb_id'] . " src=\"" . esc_url(set_url_scheme($this->attributes['value'])) . "\" />";
}
$displayStatus = "";
$displayRemove = "style=\"display: none;\"";
if (!empty($this->attributes['value'])) {
$displayStatus = "style=\"display: none;\"";
$displayRemove = "";
}
$return .= "<div class=\"dropdown-status\"{$displayStatus}>";
$return .= __('No Image', 'wpforms');
$return .= "</div>";
$return .= "</div>";
$return .= " <div class=\"dropdown-arrow\"></div>";
$return .= " </div>";
$return .= " </div>";
$return .= " <div class=\"actions\">";
$return .= " <a href=\"#\" {$displayRemove} class=\"remove button\">" . __('Remove', 'wpforms') . "</a>";
$return .= " </div>";
$return .= "</div>";
echo $return;
}