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


PHP urlencode_deep函数代码示例

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


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

示例1: test_urlencode_deep_should_encode_all_values_in_array

 /**
  * Test the whole array as input
  */
 public function test_urlencode_deep_should_encode_all_values_in_array()
 {
     $data = $this->data_test_values();
     $actual = wp_list_pluck($data, 0);
     $expected = wp_list_pluck($data, 1);
     $this->assertEquals($expected, urlencode_deep($actual));
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:10,代码来源:UrlencodeDeep.php

示例2: process_request

 public function process_request()
 {
     global $post;
     $postID = $post->ID;
     if (is_product() && isset($_GET['wsd_share'])) {
         switch ($_GET['wsd_share']) {
             case 'facebook':
                 $fb_url = $this->http() . '://www.facebook.com/sharer.php?u=' . rawurlencode(get_permalink($postID)) . '&t=' . rawurlencode($post->post_title);
                 // Redirect to Facebook
                 wp_redirect($fb_url);
                 die;
                 break;
             case 'twitter':
                 $post_title = html_entity_decode(wp_kses($post->post_title, null));
                 $post_link = get_permalink($postID);
                 $text = $post_title;
                 $url = $post_link;
                 $twitter_url = add_query_arg(urlencode_deep(array_filter(compact('text', 'url'))), 'https://twitter.com/intent/tweet');
                 // Redirect to Twitter
                 wp_redirect($twitter_url);
                 die;
                 break;
         }
     }
 }
开发者ID:amir-canteetu,项目名称:Woo_Social_Discounts,代码行数:25,代码来源:class-woo-social-discounts-public.php

示例3: um_browser_url_redirect_to

function um_browser_url_redirect_to($args)
{
    global $ultimatemember;
    if (isset($_REQUEST['redirect_to']) && !empty($_REQUEST['redirect_to'])) {
        $url = urlencode_deep($_REQUEST['redirect_to']);
        echo '<input type="hidden" name="redirect_to" id="redirect_to" value="' . esc_attr($url) . '" />';
    } else {
        if (isset($args['after_login']) && !empty($args['after_login'])) {
            switch ($args['after_login']) {
                case 'redirect_admin':
                    $url = admin_url();
                    break;
                case 'redirect_profile':
                    $url = um_user_profile_url();
                    break;
                case 'redirect_url':
                    $url = $args['redirect_url'];
                    break;
                case 'refresh':
                    $url = $ultimatemember->permalinks->get_current_url();
                    break;
            }
            $url = urlencode_deep($url);
            echo '<input type="hidden" name="redirect_to" id="redirect_to" value="' . esc_attr($url) . '" />';
        }
    }
}
开发者ID:lytranuit,项目名称:wordpress,代码行数:27,代码来源:um-actions-misc.php

示例4: get_signed_url

 /**
  * @param string $action
  *
  * @return string
  */
 public function get_signed_url($action = '')
 {
     $args = $this->data;
     // add signature to url args
     $args['s'] = $this->signature;
     return add_query_arg(urlencode_deep($args), home_url(rtrim(EDD_HELPSCOUT_API_PATH, '/') . '/' . $action));
 }
开发者ID:dannyvankooten,项目名称:edd-helpscout,代码行数:12,代码来源:class-request.php

示例5: replace_variables

 /**
  * Returns text with {variables} replaced.
  *
  * @param string $string
  * @param array $additional_replacements
  * @param array $list_ids Array of list ID's (needed if {subscriber_count} is set
  * @param string $output
  *
  * @return string $text       The text with {variables} replaced.
  * replaced.
  */
 public static function replace_variables($string, $additional_replacements = array(), $list_ids = array(), $output = 'string')
 {
     self::$replacement_output = $output;
     // replace general vars
     $replacements = array('{ip}' => self::get_client_ip(), '{current_url}' => mc4wp_get_current_url(), '{current_path}' => !empty($_SERVER['REQUEST_URI']) ? esc_html($_SERVER['REQUEST_URI']) : '', '{date}' => date('m/d/Y'), '{time}' => date('H:i:s'), '{language}' => defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : get_locale(), '{email}' => self::get_known_email(), '{user_email}' => '', '{user_firstname}' => '', '{user_lastname}' => '', '{user_name}' => '', '{user_id}' => '');
     // setup replacements for logged-in users
     if (is_user_logged_in() && ($user = wp_get_current_user()) && $user instanceof WP_User) {
         // logged in user, replace vars by user vars
         $replacements['{user_email}'] = $user->user_email;
         $replacements['{user_firstname}'] = $user->first_name;
         $replacements['{user_lastname}'] = $user->last_name;
         $replacements['{user_name}'] = $user->display_name;
         $replacements['{user_id}'] = $user->ID;
     }
     // merge with additional replacements
     $replacements = array_merge($replacements, $additional_replacements);
     // subscriber count? only fetch these if the tag is actually used
     if (stripos($string, '{subscriber_count}') !== false) {
         $mailchimp = new MC4WP_MailChimp();
         $subscriber_count = $mailchimp->get_subscriber_count($list_ids);
         $replacements['{subscriber_count}'] = $subscriber_count;
     }
     // encode replacements when output type is set to 'url'
     if (self::$replacement_output === 'url') {
         $replacements = urlencode_deep($replacements);
     }
     // perform the replacement
     $string = str_ireplace(array_keys($replacements), array_values($replacements), $string);
     // replace dynamic variables
     if (stristr($string, '{data_') !== false) {
         $string = preg_replace_callback('/\\{data_([\\w-.]+)( default=\\"([^"]*)\\"){0,1}\\}/', array('MC4WP_Tools', 'replace_request_data_variables'), $string);
     }
     return $string;
 }
开发者ID:Ore4444,项目名称:old.backfeed.cc,代码行数:45,代码来源:class-tools.php

示例6: url

 public function url($params = array(), $base = false)
 {
     $blacklist = $this->params_blacklist();
     $params = array_merge($this->params, $params);
     $url = remove_query_arg($blacklist, $base ? $base : awpcp_current_url());
     $url = add_query_arg(urlencode_deep($params), $url);
     return $url;
 }
开发者ID:sabdev1,项目名称:ljcdevsab,代码行数:8,代码来源:admin-page.php

示例7: get_tracking_url

 /**
  * Gets a Google Analytics Campaign url for this product
  *
  * @param string $path
  * @param string $link_identifier
  * @return string The full URL
  */
 public function get_tracking_url($path = '', $link_identifier = '')
 {
     $tracking_vars = array('utm_campaign' => $this->item_name . ' licensing', 'utm_medium' => 'link', 'utm_source' => $this->item_name, 'utm_content' => $link_identifier);
     // url encode tracking vars
     $tracking_vars = urlencode_deep($tracking_vars);
     $query_string = build_query($tracking_vars);
     return $this->item_url . ltrim($path, '/') . '#' . $query_string;
 }
开发者ID:siggisdairy,项目名称:siggis-web,代码行数:15,代码来源:class-product-base.php

示例8: get_url

 private function get_url($action, $transaction)
 {
     if (get_option('permalink_structure')) {
         return home_url("/awpcpx/payments/{$action}/{$transaction->id}");
     } else {
         $params = array('awpcpx' => true, 'module' => 'payments', 'action' => $action, 'awpcp-txn' => $transaction->id);
         return add_query_arg(urlencode_deep($params), home_url('index.php'));
     }
 }
开发者ID:sabdev1,项目名称:ljcdevsab,代码行数:9,代码来源:payments-api.php

示例9: widget

    function widget($args, $instance)
    {
        extract($args);
        $like_args = $this->normalize_facebook_args($instance['like_args']);
        if (empty($like_args['href']) || !$this->is_valid_facebook_url($like_args['href'])) {
            if (current_user_can('edit_theme_options')) {
                echo $before_widget;
                echo '<p>' . sprintf(__('It looks like your Facebook URL is incorrectly configured. Please check it in your <a href="%s">widget settings</a>.', 'jetpack'), admin_url('widgets.php')) . '</p>';
                echo $after_widget;
            }
            echo '<!-- Invalid Facebook Page URL -->';
            return;
        }
        $title = apply_filters('widget_title', $instance['title']);
        $page_url = is_ssl() ? str_replace('http://', 'https://', $like_args['href']) : $like_args['href'];
        $like_args['show_faces'] = (bool) $like_args['show_faces'] ? 'true' : 'false';
        $like_args['stream'] = (bool) $like_args['stream'] ? 'true' : 'false';
        $like_args['force_wall'] = (bool) $like_args['force_wall'] ? 'true' : 'false';
        $like_args['show_border'] = (bool) $like_args['show_border'] ? 'true' : 'false';
        $like_args['header'] = (bool) $like_args['header'] ? 'true' : 'false';
        $like_bg_colour = apply_filters('jetpack_fb_likebox_bg', 'dark' == $like_args['colorscheme'] ? '#000' : '#fff', $like_args['colorscheme']);
        $locale = $this->get_locale();
        if ($locale && 'en_US' != $locale) {
            $like_args['locale'] = $locale;
        }
        $like_args = urlencode_deep($like_args);
        $like_url = add_query_arg($like_args, set_url_scheme('http://www.facebook.com/plugins/likebox.php'));
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title;
            ?>
<a href="<?php 
            echo esc_url($page_url);
            ?>
"><?php 
            echo esc_html($title);
            ?>
</a><?php 
            echo $after_title;
        }
        ?>
<iframe src="<?php 
        echo esc_url($like_url);
        ?>
" scrolling="no" frameborder="0" style="border: none; overflow: hidden;<?php 
        echo 0 != $like_args['width'] ? ' width: ' . (int) $like_args['width'] . 'px; ' : '';
        ?>
 height: <?php 
        echo (int) $like_args['height'];
        ?>
px; background: <?php 
        echo esc_attr($like_bg_colour);
        ?>
"></iframe><?php 
        echo $after_widget;
        do_action('jetpack_stats_extra', 'widget', 'facebook-likebox');
    }
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:57,代码来源:facebook-likebox.php

示例10: bp_activity_action_permalink_router

/**
 * Catch and route requests for single activity item permalinks.
 *
 * @since 1.2.0
 *
 * @return bool False on failure.
 */
function bp_activity_action_permalink_router()
{
    // Not viewing activity.
    if (!bp_is_activity_component() || !bp_is_current_action('p')) {
        return false;
    }
    // No activity to display.
    if (!bp_action_variable(0) || !is_numeric(bp_action_variable(0))) {
        return false;
    }
    // Get the activity details.
    $activity = bp_activity_get_specific(array('activity_ids' => bp_action_variable(0), 'show_hidden' => true));
    // 404 if activity does not exist
    if (empty($activity['activities'][0])) {
        bp_do_404();
        return;
    } else {
        $activity = $activity['activities'][0];
    }
    // Do not redirect at default.
    $redirect = false;
    // Redirect based on the type of activity.
    if (bp_is_active('groups') && $activity->component == buddypress()->groups->id) {
        // Activity is a user update.
        if (!empty($activity->user_id)) {
            $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
            // Activity is something else.
        } else {
            // Set redirect to group activity stream.
            if ($group = groups_get_group($activity->item_id)) {
                $redirect = bp_get_group_permalink($group) . bp_get_activity_slug() . '/' . $activity->id . '/';
            }
        }
        // Set redirect to users' activity stream.
    } elseif (!empty($activity->user_id)) {
        $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
    }
    // If set, add the original query string back onto the redirect URL.
    if (!empty($_SERVER['QUERY_STRING'])) {
        $query_frags = array();
        wp_parse_str($_SERVER['QUERY_STRING'], $query_frags);
        $redirect = add_query_arg(urlencode_deep($query_frags), $redirect);
    }
    /**
     * Filter the intended redirect url before the redirect occurs for the single activity item.
     *
     * @since 1.2.2
     *
     * @param array $value Array with url to redirect to and activity related to the redirect.
     */
    if (!($redirect = apply_filters_ref_array('bp_activity_permalink_redirect_url', array($redirect, &$activity)))) {
        bp_core_redirect(bp_get_root_domain());
    }
    // Redirect to the actual activity permalink page.
    bp_core_redirect($redirect);
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:63,代码来源:bp-activity-actions.php

示例11: __construct

 /**
  * Class constructor.
  *
  * @uses plugin_basename()
  * @uses hook()
  *
  * @param string $_api_url The URL pointing to the custom API endpoint.
  * @param string $_plugin_file Path to the plugin file.
  * @param array $_api_data Optional data to send with API calls.
  * @return void
  */
 function __construct($_api_url, $_plugin_file, $_api_data = null)
 {
     $this->api_url = trailingslashit($_api_url);
     $this->api_data = urlencode_deep($_api_data);
     $this->name = plugin_basename($_plugin_file);
     $this->slug = basename($_plugin_file, '.php');
     $this->version = $_api_data['version'];
     // Set up hooks.
     $this->hook();
 }
开发者ID:Robez,项目名称:bean-shortcodes,代码行数:21,代码来源:EDD_SL_Plugin_Updater.php

示例12: gp_url

/**
 * Builds a URL relative to the GlotPress base
 * 
 * @param mixed $path string path or array of path components
 * @param array $query associative array of query arguments (optional)
 */
function gp_url($path, $query = null)
{
    $url = gp_url_join(gp_url_path(gp_get_option('url')), $path);
    if ($query && is_array($query)) {
        $url = add_query_arg(urlencode_deep($query), $url);
    } elseif ($query) {
        $url .= '?' . ltrim($query, '?');
    }
    return apply_filters('gp_url', $url, $path, $query);
}
开发者ID:rmccue,项目名称:GlotPress,代码行数:16,代码来源:url.php

示例13: get_data

 function get_data($path, $options = array())
 {
     $options = array_map('urlencode', wp_parse_args($options, array('consumer_key' => $this->source['consumer_key'])));
     $url = add_query_arg(urlencode_deep($options), "https://api.500px.com/v1/{$path}");
     $data = $this->http_get_cached($url);
     if (is_wp_error($data)) {
         return $data;
     }
     return json_decode($data, true);
 }
开发者ID:jcwproductions,项目名称:jcwproductions-blog,代码行数:10,代码来源:source.class.php

示例14: gp_url_add_path_and_query

function gp_url_add_path_and_query($base, $path, $query)
{
    // todo: same domain with current url?
    $url = gp_url_join($base, $path);
    if ($query && is_array($query)) {
        $url = add_query_arg(urlencode_deep($query), $url);
    } elseif ($query) {
        $url .= '?' . ltrim($query, '?');
    }
    return apply_filters('gp_url_add_path_and_query', $url, $base, $path, $query);
}
开发者ID:johnjamesjacoby,项目名称:GlotPress-WP,代码行数:11,代码来源:url.php

示例15: um_dynamic_login_page_redirect

function um_dynamic_login_page_redirect($redirect_to = '')
{
    global $ultimatemember;
    $uri = um_get_core_page('login');
    if (!$redirect_to) {
        $redirect_to = $ultimatemember->permalinks->get_current_url();
    }
    $redirect_key = urlencode_deep($redirect_to);
    $uri = add_query_arg('redirect_to', $redirect_key, $uri);
    return $uri;
}
开发者ID:lytranuit,项目名称:wordpress,代码行数:11,代码来源:um-short-functions.php


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