当前位置: 首页>>代码示例>>PHP>>正文


PHP esc_url_raw函数代码示例

本文整理汇总了PHP中esc_url_raw函数的典型用法代码示例。如果您正苦于以下问题:PHP esc_url_raw函数的具体用法?PHP esc_url_raw怎么用?PHP esc_url_raw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了esc_url_raw函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepare_fields

 /**
  * Prepare the PayPal IPN fields
  *
  * Details here:
  * https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
  *
  * @since  1.0.0
  * @return array
  */
 private function prepare_fields()
 {
     $subscription = $this->data['ms_relationship'];
     $membership = $subscription->get_membership();
     if (0 === $membership->price) {
         return;
     }
     $gateway = $this->data['gateway'];
     $invoice = $subscription->get_current_invoice();
     $fields = array('business' => array('id' => 'business', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $gateway->paypal_email), 'cmd' => array('id' => 'cmd', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => '_xclick'), 'bn' => array('id' => 'bn', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => 'incsub_SP'), 'item_number' => array('id' => 'item_number', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $subscription->membership_id), 'item_name' => array('id' => 'item_name', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $membership->name), 'amount' => array('id' => 'amount', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => MS_Helper_Billing::format_price($invoice->total)), 'currency_code' => array('id' => 'currency_code', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->currency), 'return' => array('id' => 'return', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => esc_url_raw(add_query_arg(array('ms_relationship_id' => $subscription->id), MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REG_COMPLETE, false)))), 'cancel_return' => array('id' => 'cancel_return', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REGISTER)), 'notify_url' => array('id' => 'notify_url', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $gateway->get_return_url()), 'lc' => array('id' => 'lc', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $gateway->paypal_site), 'invoice' => array('id' => 'invoice', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->id));
     // Don't send to paypal if free
     if (0 === $invoice->total) {
         $fields = array('gateway' => array('id' => 'gateway', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $gateway->id), 'ms_relationship_id' => array('id' => 'ms_relationship_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $subscription->id), 'step' => array('id' => 'step', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => MS_Controller_Frontend::STEP_PROCESS_PURCHASE), '_wpnonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($gateway->id . '_' . $subscription->id)));
         $this->data['action_url'] = null;
     } else {
         if ($gateway->is_live_mode()) {
             $this->data['action_url'] = 'https://www.paypal.com/cgi-bin/webscr';
         } else {
             $this->data['action_url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
         }
     }
     $fields['submit'] = array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_IMAGE, 'value' => 'https://www.paypalobjects.com/en_US/i/btn/x-click-but06.gif', 'alt' => __('PayPal - The safer, easier way to pay online', MS_TEXT_DOMAIN));
     // custom pay button defined in gateway settings
     $custom_label = $gateway->pay_button_url;
     if (!empty($custom_label)) {
         if (false !== strpos($custom_label, '://')) {
             $fields['submit']['value'] = $custom_label;
         } else {
             $fields['submit'] = array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => $custom_label);
         }
     }
     return apply_filters('ms_gateway_paypalsingle_view_prepare_fields', $fields);
 }
开发者ID:klgrimley,项目名称:mzf,代码行数:42,代码来源:class-ms-gateway-paypalsingle-view-button.php

示例2: to_html

    /**
     * Create view output.
     *
     * @since  1.0.0
     *
     * @return string
     */
    public function to_html()
    {
        $fields = $this->prepare_fields();
        $form_url = esc_url_raw(remove_query_arg(array('action', 'invitation_id')));
        if ($this->data['invitation']->is_valid()) {
            $title = __('Edit Invitation Code', MS_TEXT_DOMAIN);
        } else {
            $title = __('Add Invitation Code', MS_TEXT_DOMAIN);
        }
        ob_start();
        ?>
		<div class="ms-wrap">
			<?php 
        MS_Helper_Html::settings_header(array('title' => $title, 'title_icon_class' => 'wpmui-fa wpmui-fa-pencil-square'));
        ?>
			<form action="<?php 
        echo esc_url($form_url);
        ?>
" method="post" class="ms-form">
				<?php 
        MS_Helper_Html::settings_box($fields, '', '', 'static', 'ms-small-form');
        ?>
			</form>
			<div class="clear"></div>
		</div>
		<?php 
        $html = ob_get_clean();
        return apply_filters('ms_addon_invitation_view_edit_to_html', $html, $this);
    }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:36,代码来源:class-ms-addon-invitation-view-edit.php

示例3: init_hooks

 public static function init_hooks()
 {
     // The standalone stats page was removed in 3.0 for an all-in-one config and stats page.
     // Redirect any links that might have been bookmarked or in browser history.
     if (isset($_GET['page']) && 'akismet-stats-display' == $_GET['page']) {
         wp_safe_redirect(esc_url_raw(self::get_page_url('stats')), 301);
         die;
     }
     self::$initiated = true;
     add_action('admin_init', array('Akismet_Admin', 'admin_init'));
     add_action('admin_menu', array('Akismet_Admin', 'admin_menu'), 5);
     # Priority 5, so it's called before Jetpack's admin_menu.
     add_action('admin_notices', array('Akismet_Admin', 'display_notice'));
     add_action('admin_enqueue_scripts', array('Akismet_Admin', 'load_resources'));
     add_action('activity_box_end', array('Akismet_Admin', 'dashboard_stats'));
     add_action('rightnow_end', array('Akismet_Admin', 'rightnow_stats'));
     add_action('manage_comments_nav', array('Akismet_Admin', 'check_for_spam_button'));
     add_action('transition_comment_status', array('Akismet_Admin', 'transition_comment_status'), 10, 3);
     add_action('admin_action_akismet_recheck_queue', array('Akismet_Admin', 'recheck_queue'));
     add_action('wp_ajax_akismet_recheck_queue', array('Akismet_Admin', 'recheck_queue'));
     add_action('wp_ajax_comment_author_deurl', array('Akismet_Admin', 'remove_comment_author_url'));
     add_action('wp_ajax_comment_author_reurl', array('Akismet_Admin', 'add_comment_author_url'));
     add_filter('plugin_action_links', array('Akismet_Admin', 'plugin_action_links'), 10, 2);
     add_filter('comment_row_actions', array('Akismet_Admin', 'comment_row_action'), 10, 2);
     add_filter('comment_text', array('Akismet_Admin', 'text_add_link_class'));
     add_filter('plugin_action_links_' . plugin_basename(plugin_dir_path(__FILE__) . 'akismet.php'), array('Akismet_Admin', 'admin_plugin_settings_link'));
 }
开发者ID:valiror,项目名称:sharingdais_demo1,代码行数:27,代码来源:class.akismet-admin.php

示例4: new_service

 public function new_service($label, $url, $icon)
 {
     // Validate
     $label = trim(wp_html_excerpt(wp_kses($label, array()), 30));
     $url = trim(esc_url_raw($url));
     $icon = trim(esc_url_raw($icon));
     if ($label && $url && $icon) {
         $options = get_option('sharing-options');
         if (!is_array($options)) {
             $options = array();
         }
         $service_id = 'custom-' . time();
         // Add a new custom service
         $options['global']['custom'][] = $service_id;
         if (false !== $this->global) {
             $this->global['custom'][] = $service_id;
         }
         update_option('sharing-options', $options);
         // Create a custom service and set the options for it
         $service = new Share_Custom($service_id, array('name' => $label, 'url' => $url, 'icon' => $icon));
         $this->set_service($service_id, $service);
         // Return the service
         return $service;
     }
     return false;
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:26,代码来源:sharing-service.php

示例5: reversal

 public static function reversal($content)
 {
     if (false === stripos($content, '<script') && false === stripos($content, '<iframe') && false === stripos($content, 'class="instagram-media')) {
         return $content;
     }
     $needle = '#<blockquote class="instagram-media.+<a href="(https://instagram\\.com/p/[^/]+/)"[^>]+>.+(?=</blockquote>)</blockquote>\\n?(<script[^>]+src="//platform\\.instagram\\.com/[^>]+></script>)?#';
     if (preg_match_all($needle, $content, $matches)) {
         $replacements = array();
         $shortcode_tag = self::get_shortcode_tag();
         foreach ($matches[0] as $key => $value) {
             $replacements[$value] = '[' . $shortcode_tag . ' url="' . esc_url_raw($matches[1][$key]) . '"]';
         }
         $content = self::make_replacements_to_content($content, $replacements);
     }
     if ($iframes = self::parse_iframes($content)) {
         $replacements = array();
         foreach ($iframes as $iframe) {
             if ('instagram.com' !== self::parse_url($iframe->attrs['src'], PHP_URL_HOST)) {
                 continue;
             }
             if (preg_match('#//instagram\\.com/p/([^/]+)/embed/?#', $iframe->attrs['src'], $matches)) {
                 $embed_id = $matches[1];
             } else {
                 continue;
             }
             $replacements[$iframe->original] = '[' . self::get_shortcode_tag() . ' url="' . esc_url_raw('https://instagram.com/p/' . $embed_id . '/') . '"]';
         }
         $content = self::make_replacements_to_content($content, $replacements);
     }
     return $content;
 }
开发者ID:davisshaver,项目名称:shortcake-bakery,代码行数:31,代码来源:class-instagram.php

示例6: prepare_fields

 private function prepare_fields()
 {
     $gateway = $this->data['gateway'];
     $subscription = $this->data['ms_relationship'];
     $membership = $subscription->get_membership();
     $invoice = $subscription->get_current_invoice();
     $member = $subscription->get_member();
     $fields = array('sid' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'sid', 'value' => $gateway->seller_id), 'mode' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'mode', 'value' => '2CO'), 'type' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'li_0_type', 'value' => 'product'), 'name' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'li_0_name', 'value' => $membership->name), 'price' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'li_0_price', 'value' => $invoice->total), 'tangible' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'li_0_tangible', 'value' => 'N'), 'skip_landing' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'skip_landing', 'value' => '1'), 'user_id' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'user_id', 'value' => $member->id), 'email' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'email', 'value' => $member->email), 'currency' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'currency', 'value' => $invoice->currency), 'merchant_order_id' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'merchant_order_id', 'value' => $invoice->id), 'return_url' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'x_receipt_link_url', 'value' => esc_url_raw(add_query_arg(array('ms_relationship_id' => $subscription->id), MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REG_COMPLETE, false)))));
     if (MS_Model_Membership::PAYMENT_TYPE_RECURRING == $membership->payment_type) {
         #'li_0_reccurance' = '2 days'   // Can use # Week / # Month / # Year
         #'li_0_duration' = 'Forever'    // Same as _recurrence, with additional "Forever" option
     }
     if (false !== strpos($gateway->pay_button_url, '://')) {
         $fields['submit'] = array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_IMAGE, 'value' => $gateway->pay_button_url);
     } else {
         $fields['submit'] = array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Signup', MS_TEXT_DOMAIN));
         if ($gateway->pay_button_url) {
             $fields['submit']['value'] = $gateway->pay_button_url;
         }
     }
     // Don't send to gateway if free
     if (0 === $invoice->total) {
         $this->data['action_url'] = null;
     } else {
         if ($gateway->is_live_mode()) {
             $this->data['action_url'] = 'https://www.2checkout.com/checkout/purchase';
         } else {
             $this->data['action_url'] = 'https://sandbox.2checkout.com/checkout/purchase';
         }
     }
     return $fields;
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:32,代码来源:class-ms-gateway-2checkout-view-button.php

示例7: jetpack_instagram_handler

function jetpack_instagram_handler($matches, $atts, $url)
{
    global $content_width;
    static $did_script;
    // keep a copy of the passed-in URL since it's modified below
    $passed_url = $url;
    $max_width = 698;
    $min_width = 320;
    if (is_feed()) {
        $media_url = sprintf('http://instagr.am/p/%s/media/?size=l', $matches[2]);
        return sprintf('<a href="%s" title="%s"><img src="%s" alt="Instagram Photo" /></a>', esc_url($url), esc_attr__('View on Instagram', 'jetpack'), esc_url($media_url));
    }
    $atts = shortcode_atts(array('width' => isset($content_width) ? $content_width : $max_width, 'hidecaption' => false), $atts);
    $atts['width'] = absint($atts['width']);
    if ($atts['width'] > $max_width || $min_width > $atts['width']) {
        $atts['width'] = $max_width;
    }
    // remove the modal param from the URL
    $url = remove_query_arg('modal', $url);
    // force .com instead of .am for https support
    $url = str_replace('instagr.am', 'instagram.com', $url);
    // The oembed endpoint expects HTTP, but HTTP requests 301 to HTTPS
    $instagram_http_url = str_replace('https://', 'http://', $url);
    $instagram_https_url = str_replace('http://', 'https://', $url);
    $url_args = array('url' => $instagram_http_url, 'maxwidth' => $atts['width']);
    if ($atts['hidecaption']) {
        $url_args['hidecaption'] = 'true';
    }
    $url = esc_url_raw(add_query_arg($url_args, 'https://api.instagram.com/oembed/'));
    // Don't use object caching here by default, but give themes ability to turn it on.
    $response_body_use_cache = apply_filters('instagram_cache_oembed_api_response_body', false, $matches, $atts, $passed_url);
    $response_body = false;
    if ($response_body_use_cache) {
        $cache_key = 'oembed_response_body_' . md5($url);
        $response_body = wp_cache_get($cache_key, 'instagram_embeds');
    }
    if (!$response_body) {
        // Not using cache (default case) or cache miss
        $instagram_response = wp_remote_get($url, array('redirection' => 0));
        if (is_wp_error($instagram_response) || 200 != $instagram_response['response']['code'] || empty($instagram_response['body'])) {
            return "<!-- instagram error: invalid oratv resource -->";
        }
        $response_body = json_decode($instagram_response['body']);
        if ($response_body_use_cache) {
            // if caching it is short-lived since this is a "Cache-Control: no-cache" resource
            wp_cache_set($cache_key, $response_body, 'instagram_embeds', HOUR_IN_SECONDS + mt_rand(0, HOUR_IN_SECONDS));
        }
    }
    if (!empty($response_body->html)) {
        if (!$did_script) {
            $did_script = true;
            add_action('wp_footer', 'jetpack_instagram_add_script');
        }
        // there's a script in the response, which we strip on purpose since it's added above
        $ig_embed = preg_replace('@<(script)[^>]*?>.*?</\\1>@si', '', $response_body->html);
    } else {
        $ig_embed = jetpack_instagram_iframe_embed($instagram_https_url, $atts);
    }
    return $ig_embed;
}
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:60,代码来源:instagram.php

示例8: twentyeleven_url_grabber

/**
 * Return the URL for the first link found in the post content.
 *
 * @since Twenty Eleven 1.0
 * @return string|bool URL or false when no link is present.
 */
function twentyeleven_url_grabber()
{
    if (!preg_match('/<a\\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches)) {
        return false;
    }
    return esc_url_raw($matches[1]);
}
开发者ID:keplerf,项目名称:Partybuses.ca,代码行数:13,代码来源:functions.php

示例9: palo_filter_logout_redirect

/**
 * Redirects user after logout
 */
function palo_filter_logout_redirect($is_admin = false)
{
    global $palo_options;
    if ($is_admin || empty($palo_options['palo_logout_behavior'])) {
        $palo_logout_behavior = 'PALO_REDIRECT_DEFAULT';
    } else {
        $palo_logout_behavior = $palo_options['palo_logout_behavior'];
    }
    $referer = array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : '';
    /**
     * Perform the redirect
     */
    switch ($palo_logout_behavior) {
        case 'PALO_REDIRECT_HOME':
            wp_redirect(home_url());
            exit;
        case 'PALO_REDIRECT_URL':
            wp_redirect(esc_url_raw($palo_options['palo_logout_url']));
            exit;
        case 'PALO_REDIRECT_CURRENT':
            if ($referer) {
                wp_redirect(esc_url_raw($referer));
            } else {
                wp_redirect(home_url());
            }
            exit;
        default:
            wp_redirect(wp_login_url());
            /* Nothing */
    }
}
开发者ID:gvh1993,项目名称:project-vvvh,代码行数:34,代码来源:filters.php

示例10: form_html

 function form_html()
 {
     $form = '<div class="wpcf7" id="' . $this->unit_tag . '">';
     $url = wpcf7_get_request_uri();
     if ($frag = strstr($url, '#')) {
         $url = substr($url, 0, -strlen($frag));
     }
     $url .= '#' . $this->unit_tag;
     $url = apply_filters('wpcf7_form_action_url', $url);
     $enctype = apply_filters('wpcf7_form_enctype', '');
     $class = apply_filters('wpcf7_form_class_attr', 'wpcf7-form');
     $form .= '<form action="' . esc_url_raw($url) . '" method="post"' . ' class="' . esc_attr($class) . '"' . $enctype . '>' . "\n";
     $form .= '<div style="display: none;">' . "\n";
     $form .= '<input type="hidden" name="_wpcf7" value="' . esc_attr($this->id) . '" />' . "\n";
     $form .= '<input type="hidden" name="_wpcf7_version" value="' . esc_attr(WPCF7_VERSION) . '" />' . "\n";
     $form .= '<input type="hidden" name="_wpcf7_unit_tag" value="' . esc_attr($this->unit_tag) . '" />' . "\n";
     $form .= '</div>' . "\n";
     $form .= $this->form_elements();
     if (!$this->responses_count) {
         $form .= $this->form_response_output();
     }
     $form .= '</form>';
     $form .= '</div>';
     return $form;
 }
开发者ID:Telemedellin,项目名称:feriadelasfloresmedellin,代码行数:25,代码来源:classes.php

示例11: pranon_video_link_save

 static function pranon_video_link_save($post_id)
 {
     // Check if our nonce is set.
     if (!isset($_POST['pranon_meta_box_video_nonce'])) {
         return;
     }
     // Verify that the nonce is valid.
     if (!wp_verify_nonce($_POST['pranon_meta_box_video_nonce'], 'pranon_meta_box_video')) {
         return;
     }
     // If this is an autosave, our form has not been submitted, so we don't want to do anything.
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return;
     }
     // Check the user's permissions.
     if (isset($_POST['post_type'])) {
         if (!current_user_can('edit_page', $post_id)) {
             return;
         }
     } else {
         if (!current_user_can('edit_post', $post_id)) {
             return;
         }
     }
     /* OK, it's safe for us to save the data now. */
     // Make sure that it is set.
     if (!isset($_POST['pranon_video_url'])) {
         return;
     }
     // Sanitize user input.
     $my_data = esc_url_raw($_POST['pranon_video_url']);
     // Update the meta field in the database.
     update_post_meta($post_id, 'pranon_video_url', $my_data);
 }
开发者ID:pranonTeam,项目名称:pranon_wp_development,代码行数:34,代码来源:CustomMetaBox.php

示例12: pre_post_update

 /**
  * Save post custom fields
  *
  * This function is attached to the 'pre_post_update' action hook.
  *
  * @since 1.0.0
  */
 public function pre_post_update($post_id)
 {
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return;
     }
     // Check if quick edit
     if (!empty($_POST['_inline_edit']) && wp_verify_nonce($_POST['_inline_edit'], 'inlineeditnonce')) {
         return;
     }
     if (!empty($_POST['arcade_basic_nonce']) && !wp_verify_nonce($_POST['arcade_basic_nonce'], 'arcade_basic_nonce')) {
         return;
     }
     if (!empty($_POST['post_type']) && 'page' == $_POST['post_type']) {
         if (!current_user_can('edit_page', $post_id)) {
             return;
         }
     } else {
         if (!current_user_can('edit_post', $post_id)) {
             return;
         }
     }
     // Sanitize
     $arcade_basic_custom_image = isset($_POST['arcade_basic_custom_image']) ? esc_url_raw($_POST['arcade_basic_custom_image']) : '';
     $this->save_meta_value($post_id, 'arcade_basic_custom_image', $arcade_basic_custom_image);
 }
开发者ID:Bullrich,项目名称:JBullrich,代码行数:32,代码来源:custom-metaboxes.php

示例13: _request_access_token

 /**
  * Uses the Brightcove oAuth API to retrieve and store an access key for use with requests. The token is stored as a transient
  * with an expiration time matching that which is returned from Brightcove. The call to the API is only performed if that transient
  * is invalid or expired. Return a WP_Error object for use in WordPress in the case of failure.
  *
  * @since  1.0.0
  *
  * @see    get_transient()
  * @see    set_transient()
  * @see    delete_transient()
  * @see    wp_remote_post()
  *
  * @param bool $force_new_token whether or not to obtain a new OAuth token
  * @param bool $retry           true to retry on failure or false
  *
  * @return string|WP_Error
  */
 public function _request_access_token($force_new_token = false, $retry = true)
 {
     $transient_name = $this->transient_name;
     $token = $force_new_token ? false : get_transient($transient_name);
     if (!$token) {
         $endpoint = esc_url_raw(self::ENDPOINT_BASE . '/access_token?grant_type=client_credentials');
         $request = wp_remote_post($endpoint, $this->_http_headers);
         if ('400' == wp_remote_retrieve_response_code($request)) {
             // Just in case
             delete_transient($transient_name);
             $oauth_error = new WP_Error('oauth_access_token_failure', sprintf(__('There is a problem with your Brightcove %1$s or %2$s', 'brightcove'), '<code>client_id</code>', '<code>client_secret</code>'));
             BC_Logging::log(sprintf('BC OAUTH ERROR: %s', $oauth_error->get_error_message()));
             return $oauth_error;
         }
         $body = wp_remote_retrieve_body($request);
         $data = json_decode($body);
         if (isset($data->access_token)) {
             $token = $data->access_token;
             set_transient($transient_name, $token, $data->expires_in);
         } else {
             if (!$retry) {
                 return new WP_Error('oauth_access_token_response_failure', sprintf(esc_html__('oAuth API did not return us an access token', 'brightcove')));
             }
             return $this->_request_access_token($force_new_token, false);
         }
     }
     return $token;
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:45,代码来源:class-bc-oauth.php

示例14: cafemocha_custom_header_fonts

/**
 * Loads our special font CSS file.
 *
 * @since Twenty Twelve 1.2
 *
 * @return void
 */
function cafemocha_custom_header_fonts()
{
    $font_url = cafemocha_get_font_url();
    if (!empty($font_url)) {
        wp_enqueue_style('cafemocha-fonts', esc_url_raw($font_url), array(), null);
    }
}
开发者ID:CafeMochaOrg,项目名称:SourceCode,代码行数:14,代码来源:custom-header.php

示例15: parse_query

 /**
  * Hook into the query parsing to detect oEmbed requests.
  *
  * If an oEmbed request is made, trigger the output.
  *
  * @since 4.4.0
  *
  * @param WP_Query $wp_query The WP_Query instance (passed by reference).
  */
 public function parse_query($wp_query)
 {
     if (false === $wp_query->get('oembed', false)) {
         return;
     }
     if (false === $wp_query->get('url', false)) {
         status_header(400);
         echo 'URL parameter missing';
         exit;
     }
     $url = esc_url_raw(get_query_var('url'));
     $format = wp_oembed_ensure_format(get_query_var('format'));
     /**
      * Filter the maxwidth oEmbed parameter.
      *
      * @since 4.4.0
      *
      * @param int $maxwidth Maximum allowed width. Default 600.
      */
     $maxwidth = apply_filters('oembed_default_width', 600);
     $maxwidth = absint(get_query_var('maxwidth', $maxwidth));
     $callback = get_query_var('_jsonp', false);
     $request = array('url' => $url, 'format' => $format, 'maxwidth' => $maxwidth, 'callback' => $callback);
     echo $this->dispatch($request);
     exit;
 }
开发者ID:hadywisam,项目名称:WordPress,代码行数:35,代码来源:class-wp-oembed-controller.php


注:本文中的esc_url_raw函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。