• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_parse_url函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: set_from_vulnerabilities_array

 /**
  * Set the messages array from a vulnerabilities array.
  *
  * @param array $vulnerabilities Array of vulnerability objects.
  */
 public function set_from_vulnerabilities_array(array $vulnerabilities)
 {
     $this->messages = [];
     if (empty($vulnerabilities)) {
         return;
     }
     foreach ($vulnerabilities as $vulnerability) {
         $message = ['title' => $vulnerability->title, 'meta' => [], 'links' => []];
         if (!is_null($vulnerability->published_date)) {
             $message['meta'][] = sprintf('Published %s', $vulnerability->published_date->format('d M Y'));
         }
         if (isset($vulnerability->references->url)) {
             foreach ($vulnerability->references->url as $url) {
                 $parsed = wp_parse_url($url);
                 $host = isset($parsed['host']) ? $parsed['host'] : $url;
                 $message['links'][$url] = $host;
             }
         }
         $message['links'][sprintf('https://wpvulndb.com/vulnerabilities/%s', $vulnerability->id)] = 'wpvulndb.com';
         if (is_null($vulnerability->fixed_in)) {
             $message['meta'][] = 'Not fixed yet';
         } else {
             $message['meta'][] = sprintf('Fixed in v%s', $vulnerability->fixed_in);
         }
         $this->messages[] = $message;
     }
 }
开发者ID:ssnepenthe,项目名称:soter,代码行数:32,代码来源:Results.php


示例2: is_same_origin

 protected function is_same_origin($src)
 {
     $script_url = wp_parse_url($src);
     $home_url = wp_parse_url(home_url());
     // Bad URL.
     if (!isset($script_url['host']) || !isset($home_url['host'])) {
         return true;
     }
     return $script_url['host'] === $home_url['host'];
 }
开发者ID:ssnepenthe,项目名称:homonoia,代码行数:10,代码来源:class-sri-injector.php


示例3: twitter_url_to_user

 /**
  * @param $twitter_profile
  *
  * @return mixed
  * @since 2.3.5
  * @since 2.3.5.1 Bail if < WordPress 4.4 for now.
  */
 public static function twitter_url_to_user($twitter_profile)
 {
     // If they're below 4.4 (no wp_parse_url) bail. We can improve this for <4.4 later or just hold out until we drop 4.4 support.
     if (!function_exists('wp_parse_url')) {
         return $twitter_profile;
     }
     //extract the twitter username from the url
     $parsed_twitter_profile = wp_parse_url($twitter_profile);
     $path = $parsed_twitter_profile['path'];
     $path_parts = explode('/', $path);
     $twitter_profile = $path_parts[1];
     return $twitter_profile;
 }
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:20,代码来源:opengraph.php


示例4: get_video_embed_url

 /**
  * Convert a "watch" url into an "embed"
  * Eg https://www.youtube.com/watch?v=OQZKh8Bjdv0 to https://www.youtube.com/embed/OQZKh8Bjdv0
  * Or https://vimeo.com/155086124 to https://player.vimeo.com/video/155086124
  *
  * @param string $url The video url.
  * @return string
  */
 public static function get_video_embed_url($url)
 {
     if (strpos($url, 'youtube') !== false && strpos($url, 'watch') !== false) {
         $parts = wp_parse_url($url);
         if (is_array($parts) && isset($parts['query'])) {
             parse_str($parts['query']);
             if (isset($v)) {
                 return 'https://www.youtube.com/embed/' . $v;
             }
         }
     }
     if (strpos($url, 'vimeo') !== false && strpos($url, 'player') === false) {
         $parts = wp_parse_url($url);
         if (is_array($parts) && isset($parts['path'])) {
             return 'https://player.vimeo.com/video' . $parts['path'];
         }
     }
     return $url;
 }
开发者ID:moxie-lean,项目名称:wp-elements,代码行数:27,代码来源:Utils.php


示例5: __construct

 /**
  * Class constructor.
  *
  * @param array $args Configuration array.
  *
  * @throws \RuntimeException If home_url() cannot be parsed properly.
  */
 public function __construct(array $args = [])
 {
     // Revisit - at a minimum this won't hold up against ccSLDs.
     $host = wp_parse_url(home_url());
     if (!isset($host['host'])) {
         // @todo
         throw new \RuntimeException();
     }
     $host = $host['host'];
     $host_parts = explode('.', $host);
     $tld = array_pop($host_parts);
     $domain = array_pop($host_parts);
     $defaults = ['aggressive' => apply_filters('metis.cdn.aggressive.default', true), 'domain' => apply_filters('metis.cdn.domain.default', sprintf('static.%s.%s', $domain, $tld)), 'extensions' => apply_filters('metis.cdn.extensions.default', ['css', 'gif', 'ico', 'jpe?g', 'js', 'png', 'svg'])];
     $this->args = wp_parse_args($args, $defaults);
     $this->assert_string($this->args['domain']);
     $this->assert_array_of_strings($this->args['extensions']);
     $this->elements = ['img' => ['src', 'srcset'], 'link' => ['href'], 'meta' => ['content'], 'script' => ['src']];
     $this->replace = sprintf('\\1%s\\2\\3', $this->args['domain']);
     $this->search = sprintf('/(https?\\:(?:\\\\)?\\/(?:\\\\)?\\/)%s((?:\\\\)?\\/[^\'"]*?)(\\.(?:%s))/', preg_quote($host), implode('|', $this->args['extensions']));
 }
开发者ID:ssnepenthe,项目名称:metis,代码行数:27,代码来源:CDN.php


示例6: get_related_events

 public function get_related_events($request)
 {
     $context = !empty($request['context']) ? $request['context'] : 'view';
     $url = wp_parse_url($_SERVER['REQUEST_URI']);
     $events_index = preg_match('/events$/', $url['path']);
     if ($context === 'embed' && $events_index) {
         return [];
         // when hitting the events index, we don't need the related events data
     }
     $event_id = $request['event_id'];
     $genre = get_post_meta($event_id, 'event_genre', true);
     $events_in_genre_args = array('post_type' => 'event', 'post_status' => array('publish'), 'posts_per_page' => -1, 'post__not_in' => array($event_id), 'meta_query' => array('relation' => 'AND', 'genre_clause' => array('key' => 'event_genre', 'value' => $genre, 'compare' => '='), 'last_event_instance_clause' => array('key' => 'last_event_instance', 'value' => date('Y-m-d H:i:s'), 'type' => 'DATETIME', 'compare' => '>=')), 'orderby' => 'last_event_instance_clause', 'order' => 'ASC');
     $related_events = get_posts($events_in_genre_args);
     $related_event_ids = array_map(function ($event) {
         return $event->ID;
     }, $related_events);
     if (count($related_event_ids)) {
         $request->set_param('filter', array('orderby' => 'post__in', 'post__in' => array_values($related_event_ids), 'post_type' => 'event', 'post__not_in' => array($event_id)));
         $request->set_param('per_page', 3);
         return $this->get_items($request);
     } else {
         return [];
     }
 }
开发者ID:rooftopcms,项目名称:rooftop-events,代码行数:24,代码来源:class-rooftop-events-controller.php


示例7: wp_resource_hints_scripts_styles

/**
 * Adds dns-prefetch for all scripts and styles enqueued from external hosts.
 *
 * @since 4.6.0
 */
function wp_resource_hints_scripts_styles()
{
    global $wp_scripts, $wp_styles;
    $unique_hosts = array();
    if (is_object($wp_scripts) && !empty($wp_scripts->registered)) {
        foreach ($wp_scripts->registered as $registered_script) {
            $parsed = wp_parse_url($registered_script->src);
            if (!empty($parsed['host']) && !in_array($parsed['host'], $unique_hosts) && $parsed['host'] !== $_SERVER['SERVER_NAME']) {
                $unique_hosts[] = $parsed['host'];
            }
        }
    }
    if (is_object($wp_styles) && !empty($wp_styles->registered)) {
        foreach ($wp_styles->registered as $registered_style) {
            $parsed = wp_parse_url($registered_style->src);
            if (!empty($parsed['host']) && !in_array($parsed['host'], $unique_hosts) && $parsed['host'] !== $_SERVER['SERVER_NAME']) {
                $unique_hosts[] = $parsed['host'];
            }
        }
    }
    return $unique_hosts;
}
开发者ID:pjsong,项目名称:WordPress,代码行数:27,代码来源:general-template.php


示例8: remove_all_non_snapshot_admin_bar_links

 /**
  * Remove all admin bar nodes that have links and which aren't for snapshots.
  *
  * @param \WP_Admin_Bar $wp_admin_bar Admin bar.
  */
 public function remove_all_non_snapshot_admin_bar_links($wp_admin_bar)
 {
     if (empty($this->snapshot)) {
         return;
     }
     $snapshot_admin_bar_node_ids = array('customize', 'exit-customize-snapshot', 'inspect-customize-snapshot');
     foreach ($wp_admin_bar->get_nodes() as $node) {
         if (in_array($node->id, $snapshot_admin_bar_node_ids, true) || '#' === substr($node->href, 0, 1)) {
             continue;
         }
         $parsed_link_url = wp_parse_url($node->href);
         $parsed_home_url = wp_parse_url(home_url('/'));
         $is_external_link = isset($parsed_link_url['host']) && $parsed_link_url['host'] !== $parsed_home_url['host'] || isset($parsed_link_url['path']) && 0 !== strpos($parsed_link_url['path'], $parsed_home_url['path']) || (!isset($parsed_link_url['query']) || !preg_match('#(^|&)customize_snapshot_uuid=#', $parsed_link_url['query']));
         if ($is_external_link) {
             $wp_admin_bar->remove_node($node->id);
         }
     }
 }
开发者ID:xwp,项目名称:wp-customize-snapshots,代码行数:23,代码来源:class-customize-snapshot-manager.php


示例9: give_send_back_to_checkout

/**
 * Send back to donation form..
 *
 * Used to redirect a user back to the donation form if there are errors present.
 *
 * @param array $args
 *
 * @access public
 * @since  1.0
 * @return Void
 */
function give_send_back_to_checkout($args = array())
{
    $url = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : '';
    //Set the form_id.
    if (isset($_POST['give-form-id'])) {
        $form_id = sanitize_text_field($_POST['give-form-id']);
    } else {
        $form_id = 0;
    }
    //Need a URL to continue. If none, redirect back to single form.
    if (empty($url)) {
        wp_safe_redirect(get_permalink($form_id));
        give_die();
    }
    $defaults = array('form-id' => (int) $form_id);
    // Check for backward compatibility.
    if (is_string($args)) {
        $args = str_replace('?', '', $args);
    }
    $args = wp_parse_args($args, $defaults);
    // Merge URL query with $args to maintain third-party URL parameters after redirect.
    $url_data = wp_parse_url($url);
    //Check if an array to prevent notices before parsing.
    if (isset($url_data['query']) && !empty($url_data['query'])) {
        parse_str($url_data['query'], $query);
        //Precaution: don't allow any CC info.
        unset($query['card_number']);
        unset($query['card_cvc']);
    } else {
        //No $url_data so pass empty array.
        $query = array();
    }
    $new_query = array_merge($args, $query);
    $new_query_string = http_build_query($new_query);
    // Assemble URL parts.
    $redirect = home_url('/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap');
    //Redirect them.
    wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
    give_die();
}
开发者ID:wordimpress,项目名称:give,代码行数:51,代码来源:functions.php


示例10: test_customize_link

 /**
  * @ticket 30937
  * @covers wp_admin_bar_customize_menu()
  */
 public function test_customize_link()
 {
     global $wp_customize;
     require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
     $uuid = wp_generate_uuid4();
     $this->go_to(home_url("/?customize_changeset_uuid={$uuid}"));
     wp_set_current_user(self::$admin_id);
     $this->factory()->post->create(array('post_type' => 'customize_changeset', 'post_status' => 'auto-draft', 'post_name' => $uuid));
     $wp_customize = new WP_Customize_Manager(array('changeset_uuid' => $uuid));
     $wp_customize->start_previewing_theme();
     set_current_screen('front');
     $wp_admin_bar = $this->get_standard_admin_bar();
     $node = $wp_admin_bar->get_node('customize');
     $this->assertNotEmpty($node);
     $parsed_url = wp_parse_url($node->href);
     $query_params = array();
     wp_parse_str($parsed_url['query'], $query_params);
     $this->assertEquals($uuid, $query_params['changeset_uuid']);
     $this->assertNotContains('changeset_uuid', $query_params['url']);
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:24,代码来源:adminbar.php


示例11: test_replace_customize_link

 /**
  * Test replace_customize_link.
  *
  * @covers CustomizeSnapshots\Customize_Snapshot_Manager::replace_customize_link()
  */
 public function test_replace_customize_link()
 {
     global $wp_admin_bar;
     set_current_screen('front');
     require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
     remove_all_actions('admin_bar_menu');
     $this->go_to(home_url('?customize_snapshot_uuid=' . self::UUID));
     $_REQUEST['customize_snapshot_uuid'] = self::UUID;
     $manager = new Customize_Snapshot_Manager($this->plugin);
     $manager->init();
     // Ensure customize link remains unknown if user lacks cap.
     wp_set_current_user(0);
     $wp_admin_bar = new \WP_Admin_Bar();
     // WPCS: Override OK.
     $wp_admin_bar->initialize();
     $wp_admin_bar->add_menus();
     do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
     $this->assertEmpty($wp_admin_bar->get_node('customize'));
     // Ensure customize link modified.
     wp_set_current_user($this->user_id);
     $wp_admin_bar = new \WP_Admin_Bar();
     // WPCS: Override OK.
     $wp_admin_bar->initialize();
     $wp_admin_bar->add_menus();
     do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
     $node = $wp_admin_bar->get_node('customize');
     $this->assertTrue(is_object($node));
     $parsed_url = wp_parse_url($node->href);
     $query_params = array();
     parse_str($parsed_url['query'], $query_params);
     $this->assertArrayHasKey('customize_snapshot_uuid', $query_params);
     $this->assertEquals(self::UUID, $query_params['customize_snapshot_uuid']);
     $this->assertArrayHasKey('url', $query_params);
     $parsed_preview_url = wp_parse_url($query_params['url']);
     $this->assertArrayNotHasKey('query', $parsed_preview_url);
 }
开发者ID:xwp,项目名称:wp-customize-snapshots,代码行数:41,代码来源:test-class-customize-snapshot-manager.php


示例12: fetchAndSaveUniqueImage

 /**
  * Fetch an image with wp_remote_get(), save it to $fullpath with a unique name.
  * Will return an empty string if something went wrong.
  *
  * @param $url string
  * @param $fullpath string
  *
  * @return string filename
  */
 protected function fetchAndSaveUniqueImage($url, $fullpath)
 {
     if (isset($this->fetchedImageCache[$url])) {
         return $this->fetchedImageCache[$url];
     }
     $response = wp_remote_get($url, array('timeout' => $this->timeout));
     // WordPress error?
     if (is_wp_error($response)) {
         try {
             // protocol relative urls handed to wp_remote_get will fail
             // try adding a protocol
             $protocol_relative = wp_parse_url($url);
             if (!isset($protocol_relative['scheme'])) {
                 if (true === is_ssl()) {
                     $url = 'https:' . $url;
                 } else {
                     $url = 'http:' . $url;
                 }
             }
             $response = wp_remote_get($url, array('timeout' => $this->timeout));
             if (is_wp_error($response)) {
                 throw new \Exception('Bad URL: ' . $url);
             }
         } catch (\Exception $exc) {
             $this->fetchedImageCache[$url] = '';
             error_log('\\PressBooks\\Export\\Epub201\\fetchAndSaveUniqueImage wp_error on wp_remote_get() - ' . $response->get_error_message() . ' - ' . $exc->getMessage());
             return '';
         }
     }
     // Basename without query string
     $filename = explode('?', basename($url));
     // isolate latex image service from WP, add file extension
     if ('s.wordpress.com' == parse_url($url, PHP_URL_HOST) && 'latex.php' == $filename[0]) {
         $filename = md5(array_pop($filename));
         // content-type = 'image/png'
         $type = explode('/', $response['headers']['content-type']);
         $type = array_pop($type);
         $filename = $filename . '.' . $type;
     } else {
         $filename = array_shift($filename);
         $filename = sanitize_file_name(urldecode($filename));
         $filename = Sanitize\force_ascii($filename);
     }
     $tmp_file = \Pressbooks\Utility\create_tmp_file();
     file_put_contents($tmp_file, wp_remote_retrieve_body($response));
     if (!\Pressbooks\Image\is_valid_image($tmp_file, $filename)) {
         $this->fetchedImageCache[$url] = '';
         error_log('\\PressBooks\\Export\\Epub201\\fetchAndSaveUniqueImage is_valid_image, not a valid image ');
         return '';
         // Not an image
     }
     if ($this->compressImages) {
         $format = explode('.', $filename);
         $format = strtolower(end($format));
         // Extension
         \Pressbooks\Image\resize_down($format, $tmp_file);
     }
     // Check for duplicates, save accordingly
     if (!file_exists("{$fullpath}/{$filename}")) {
         copy($tmp_file, "{$fullpath}/{$filename}");
     } elseif (md5(file_get_contents($tmp_file)) != md5(file_get_contents("{$fullpath}/{$filename}"))) {
         $filename = wp_unique_filename($fullpath, $filename);
         copy($tmp_file, "{$fullpath}/{$filename}");
     }
     $this->fetchedImageCache[$url] = $filename;
     return $filename;
 }
开发者ID:pressbooks,项目名称:pressbooks,代码行数:76,代码来源:class-pb-epub201.php


示例13: is_cross_domain

 /**
  * Determines whether the admin and the frontend are on different domains.
  *
  * @since 4.7.0
  * @access public
  *
  * @return bool Whether cross-domain.
  */
 public function is_cross_domain()
 {
     $admin_origin = wp_parse_url(admin_url());
     $home_origin = wp_parse_url(home_url());
     $cross_domain = strtolower($admin_origin['host']) !== strtolower($home_origin['host']);
     return $cross_domain;
 }
开发者ID:kucrut,项目名称:wordpress,代码行数:15,代码来源:class-wp-customize-manager.php


示例14: robots_txt

 /**
  * Edits the robots.txt output
  *
  * Requires not to have a robots.txt file in the root directory
  *
  * @uses robots_txt filter located at WP core
  *
  * @since 2.2.9
  *
  * @global int $blog_id;
  *
  * @todo maybe combine with noindex/noarchive/(nofollow) -> only when object caching?
  */
 public function robots_txt($robots_txt = '', $public = '')
 {
     global $blog_id;
     /**
      * Don't do anything if the blog isn't public
      */
     if ('0' === $public) {
         return $robots_txt;
     }
     $revision = '1';
     $cache_key = 'robots_txt_output_' . $revision . $blog_id;
     $output = $this->object_cache_get($cache_key);
     if (false === $output) {
         $output = '';
         /**
          * Apply filters the_seo_framework_robots_txt_pre & the_seo_framework_robots_txt_pro
          * 		: Add custom cacheable lines.
          *		: Don't forget to add line breaks ( "\r\n" | PHP_EOL )
          *
          * @since 2.5.0
          */
         $pre = (string) apply_filters('the_seo_framework_robots_txt_pre', '');
         $pro = (string) apply_filters('the_seo_framework_robots_txt_pro', '');
         $site_url = wp_parse_url(site_url());
         $path = !empty($site_url['path']) ? $site_url['path'] : '';
         $output .= $pre;
         //* Output defaults
         $output .= "User-agent: *\r\n";
         $output .= "Disallow: {$path}/wp-admin/\r\n";
         $output .= "Allow: {$path}/wp-admin/admin-ajax.php\r\n";
         /**
          * Prevents query indexing
          * @since 2.2.9
          *
          * Applies filters the_seo_framework_robots_disallow_queries : Whether to allow queries for robots.
          * @since 2.5.0
          */
         if (apply_filters('the_seo_framework_robots_disallow_queries', false)) {
             $home_url = wp_parse_url(rtrim($this->the_home_url_from_cache(), ' /\\'));
             $home_path = !empty($home_url['path']) ? $home_url['path'] : '';
             $output .= "Disallow: {$home_path}/*?*\r\n";
         }
         $output .= $pro;
         if ($this->get_option('sitemaps_robots') && $this->can_do_sitemap_robots()) {
             //* Add whitespace before sitemap.
             $output .= "\r\n";
             //* Add sitemap full url
             $output .= 'Sitemap: ' . $this->the_home_url_from_cache(true) . "sitemap.xml\r\n";
         }
         $this->object_cache_set($cache_key, $output, 86400);
     }
     /**
      * Completely override robots with output.
      * @since 2.5.0
      */
     $robots_txt = $output;
     return $robots_txt;
 }
开发者ID:sybrew,项目名称:the-seo-framework,代码行数:71,代码来源:sitemaps.class.php


示例15: true_purge_all

 function true_purge_all()
 {
     global $rt_wp_nginx_helper;
     $prefix = trim($rt_wp_nginx_helper->options['redis_prefix']);
     $this->log('* * * * *');
     // If Purge Cache link click from network admin then purge all
     if (is_network_admin()) {
         delete_keys_by_wildcard($prefix . '*');
         $this->log('* Purged Everything! * ');
     } else {
         // Else purge only site specific cache
         $parse = wp_parse_url(get_site_url());
         $parse['path'] = empty($parse['path']) ? '/' : $parse['path'];
         delete_keys_by_wildcard($prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'] . '*');
         $this->log('* ' . get_site_url() . ' Purged! * ');
     }
     $this->log('* * * * *');
 }
开发者ID:kanei,项目名称:vantuch.cz,代码行数:18,代码来源:redis-purger.php


示例16: test_add_state_query_params

 /**
  * Test WP_Customize_Manager::add_state_query_params().
  *
  * @ticket 30937
  * @covers WP_Customize_Manager::add_state_query_params()
  */
 function test_add_state_query_params()
 {
     $preview_theme = $this->get_inactive_core_theme();
     $uuid = wp_generate_uuid4();
     $messenger_channel = 'preview-0';
     $wp_customize = new WP_Customize_Manager(array('changeset_uuid' => $uuid, 'messenger_channel' => $messenger_channel));
     $url = $wp_customize->add_state_query_params(home_url('/'));
     $parsed_url = wp_parse_url($url);
     parse_str($parsed_url['query'], $query_params);
     $this->assertArrayHasKey('customize_messenger_channel', $query_params);
     $this->assertArrayHasKey('customize_changeset_uuid', $query_params);
     $this->assertArrayNotHasKey('customize_theme', $query_params);
     $this->assertEquals($uuid, $query_params['customize_changeset_uuid']);
     $this->assertEquals($messenger_channel, $query_params['customize_messenger_channel']);
     $uuid = wp_generate_uuid4();
     $wp_customize = new WP_Customize_Manager(array('changeset_uuid' => $uuid, 'messenger_channel' => null, 'theme' => $preview_theme));
     $url = $wp_customize->add_state_query_params(home_url('/'));
     $parsed_url = wp_parse_url($url);
     parse_str($parsed_url['query'], $query_params);
     $this->assertArrayNotHasKey('customize_messenger_channel', $query_params);
     $this->assertArrayHasKey('customize_changeset_uuid', $query_params);
     $this->assertArrayHasKey('customize_theme', $query_params);
     $this->assertEquals($uuid, $query_params['customize_changeset_uuid']);
     $this->assertEquals($preview_theme, $query_params['customize_theme']);
     $uuid = wp_generate_uuid4();
     $wp_customize = new WP_Customize_Manager(array('changeset_uuid' => $uuid, 'messenger_channel' => null, 'theme' => $preview_theme));
     $url = $wp_customize->add_state_query_params('http://not-allowed.example.com/?q=1');
     $parsed_url = wp_parse_url($url);
     parse_str($parsed_url['query'], $query_params);
     $this->assertArrayNotHasKey('customize_messenger_channel', $query_params);
     $this->assertArrayNotHasKey('customize_changeset_uuid', $query_params);
     $this->assertArrayNotHasKey('customize_theme', $query_params);
 }
开发者ID:CompositeUK,项目名称:clone.WordPress-Develop,代码行数:39,代码来源:manager.php


示例17: is_same_origin

 /**
  * Determine whether the given asset source is local.
  *
  * @param string $src Asset URL.
  *
  * @return boolean
  */
 protected function is_same_origin($src)
 {
     $script_url = wp_parse_url($src);
     $home_url = wp_parse_url(home_url());
     if (!isset($script_url['host']) || !isset($home_url['host'])) {
         // Something is wrong...
         return true;
     }
     return $script_url === $home_url;
 }
开发者ID:ssnepenthe,项目名称:homonoia,代码行数:17,代码来源:Frontend.php


示例18: wp_dependencies_unique_hosts

/**
 * Retrieves a list of unique hosts of all enqueued scripts and styles.
 *
 * @since 4.6.0
 *
 * @return array A list of unique hosts of enqueued scripts and styles.
 */
function wp_dependencies_unique_hosts()
{
    global $wp_scripts, $wp_styles;
    $unique_hosts = array();
    foreach (array($wp_scripts, $wp_styles) as $dependencies) {
        if ($dependencies instanceof WP_Dependencies && !empty($dependencies->queue)) {
            foreach ($dependencies->queue as $handle) {
                if (!isset($dependencies->registered[$handle])) {
                    continue;
                }
                /* @var _WP_Dependency $dependency */
                $dependency = $dependencies->registered[$handle];
                $parsed = wp_parse_url($dependency->src);
                if (!empty($parsed['host']) && !in_array($parsed['host'], $unique_hosts) && $parsed['host'] !== $_SERVER['SERVER_NAME']) {
                    $unique_hosts[] = $parsed['host'];
                }
            }
        }
    }
    return $unique_hosts;
}
开发者ID:ryelle,项目名称:WordPress,代码行数:28,代码来源:general-template.php


示例19: logout_action

 /**
  * Logout action listener
  */
 public function logout_action()
 {
     $parsed = wp_parse_url(home_url());
     setcookie($this->cookie_name, '', strtotime('-1 day'), '/', '.' . $parsed['host']);
 }
开发者ID:moxie-lean,项目名称:wp-endpoints-admin-bar,代码行数:8,代码来源:AdminBarApi.php


示例20: test_wp_parse_url_with_component

 /**
  * @ticket 36356
  *
  * @dataProvider parse_url_component_testcases
  */
 function test_wp_parse_url_with_component($url, $component, $expected)
 {
     $actual = wp_parse_url($url, $component);
     $this->assertSame($expected, $actual);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:10,代码来源:http.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_password_change_notification函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_parse_str函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap