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

PHP parse_url函数代码示例

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

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



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

示例1: filterLoad

 /**
  * Filters an asset after it has been loaded.
  *
  * @param  \Assetic\Asset\AssetInterface  $asset
  * @return void
  */
 public function filterLoad(AssetInterface $asset)
 {
     $max_nesting_level = ini_get('xdebug.max_nesting_level');
     $memory_limit = ini_get('memory_limit');
     if ($max_nesting_level && $max_nesting_level < 200) {
         ini_set('xdebug.max_nesting_level', 200);
     }
     if ($memory_limit && $memory_limit < 256) {
         ini_set('memory_limit', '256M');
     }
     $root = $asset->getSourceRoot();
     $path = $asset->getSourcePath();
     $dirs = array();
     $lc = new \Less_Parser(array('compress' => true));
     if ($root && $path) {
         $dirs[] = dirname($root . '/' . $path);
     }
     foreach ($this->loadPaths as $loadPath) {
         $dirs[] = $loadPath;
     }
     $lc->SetImportDirs($dirs);
     $url = parse_url($this->getRequest()->getUriForPath(''));
     $absolutePath = str_replace(public_path(), '', $root);
     if (isset($url['path'])) {
         $absolutePath = $url['path'] . $absolutePath;
     }
     $lc->parseFile($root . '/' . $path, $absolutePath);
     $asset->setContent($lc->getCss());
 }
开发者ID:cartalyst,项目名称:assetic-filters,代码行数:35,代码来源:LessphpFilter.php


示例2: __construct

 /**
  * @param mixed $in
  */
 public function __construct($in = null)
 {
     $fields = array('to', 'cc', 'bcc', 'message', 'body', 'subject');
     if (is_string($in)) {
         if (($pos = strpos($in, '?')) !== false) {
             parse_str(substr($in, $pos + 1), $this->args);
             $this->args['to'] = substr($in, 0, $pos);
         } else {
             $this->args['to'] = $in;
         }
     } elseif ($in instanceof Horde_Variables) {
         foreach ($fields as $val) {
             if (isset($in->{$val})) {
                 $this->args[$val] = $in->{$val};
             }
         }
     } elseif (is_array($in)) {
         $this->args = $in;
     }
     if (isset($this->args['to']) && strpos($this->args['to'], 'mailto:') === 0) {
         $mailto = @parse_url($this->args['to']);
         if (is_array($mailto)) {
             $this->args['to'] = isset($mailto['path']) ? $mailto['path'] : '';
             if (!empty($mailto['query'])) {
                 parse_str($mailto['query'], $vals);
                 foreach ($fields as $val) {
                     if (isset($vals[$val])) {
                         $this->args[$val] = $vals[$val];
                     }
                 }
             }
         }
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:37,代码来源:Link.php


示例3: global_filter

/**
 * 全局安全过滤函数
 * 支持SQL注入和跨站脚本攻击
 */
function global_filter()
{
    //APP,ACT 分别为控制器和控制器方法
    $params = array(APP, ACT);
    foreach ($params as $k => $v) {
        if (!preg_match("/^[a-zA-Z0-9_-]+\$/", $v)) {
            header_status_404();
        }
    }
    $arrStr = array('%0d%0a', "'", '<', '>', '$', 'script', 'document', 'eval', 'atestu', 'select', 'insert?into', 'delete?from');
    global_inject_input($_SERVER['HTTP_REFERER'], $arrStr, true);
    global_inject_input($_SERVER['HTTP_USER_AGENT'], $arrStr, true);
    global_inject_input($_SERVER['HTTP_ACCEPT_LANGUAGE'], $arrStr, true);
    global_inject_input($_GET, array_merge($arrStr, array('"')), true);
    //global_inject_input($_COOKIE, array_merge($arrStr, array('"', '&')), true);
    //cookie会有对url的记录(pGClX_last_url)。去掉对&的判断
    global_inject_input($_COOKIE, array_merge($arrStr, array('"')), true);
    global_inject_input($_SERVER, array('%0d%0a'), true);
    //处理跨域POST提交问题
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        //处理客户端POST请求处理没有HTTP_REFERER参数问题
        if (isset($_SERVER['HTTP_REFERER'])) {
            $url = parse_url($_SERVER['HTTP_REFERER']);
            $referer_host = !empty($url['port']) && $url['port'] != '80' ? $url['host'] . ':' . $url['port'] : $url['host'];
            if ($referer_host != $_SERVER['HTTP_HOST']) {
                header_status_404();
            }
        }
    }
    global_inject_input($_POST, array('%0d%0a'));
    global_inject_input($_REQUEST, array('%0d%0a'));
}
开发者ID:w5678912345,项目名称:Web-Security-Filter,代码行数:36,代码来源:security_filter.php


示例4: getdata

 function getdata($style, $parameter)
 {
     $array = array();
     foreach ($parameter as $key => $value) {
         if (is_array($value)) {
             $parameter[$key] = implode(',', $value);
         }
     }
     $parameter['clientid'] = $this->blockdata['clientid'];
     $parameter['op'] = 'getdata';
     $parameter['charset'] = CHARSET;
     $parameter['version'] = $this->blockdata['version'];
     $xmlurl = $this->blockdata['url'];
     $parse = parse_url($xmlurl);
     if (!empty($parse['host'])) {
         define('IN_ADMINCP', true);
         require_once libfile('function/importdata');
         $importtxt = @dfsockopen($xmlurl, 0, create_sign_url($parameter, $this->blockdata['key'], $this->blockdata['signtype']));
     } else {
         $importtxt = @file_get_contents($xmlurl);
     }
     if ($importtxt) {
         require libfile('class/xml');
         $array = xml2array($importtxt);
     }
     $idtype = 'xml_' . $this->blockdata['id'];
     foreach ($array['data'] as $key => $value) {
         $value['idtype'] = $idtype;
         $array['data'][$key] = $value;
     }
     if (empty($array['data'])) {
         $array['data'] = null;
     }
     return $array;
 }
开发者ID:dalinhuang,项目名称:hlwbbsvincent,代码行数:35,代码来源:block_xml.php


示例5: get_absolute_link

/**
 * Retourne le lien absolu
 */
function get_absolute_link($relative_link, $url)
{
    /* return if already absolute URL */
    if (parse_url($relative_link, PHP_URL_SCHEME) != '') {
        return $relative_link;
    }
    /* queries and anchors */
    if ($relative_link[0] == '#' || $relative_link[0] == '?') {
        return $url . $relative_link;
    }
    /* parse base URL and convert to local variables:
       $scheme, $host, $path */
    extract(parse_url($url));
    /* remove non-directory element from path */
    $path = preg_replace('#/[^/]*$#', '', $path);
    /* destroy path if relative url points to root */
    if ($relative_link[0] == '/') {
        $path = '';
    }
    /* dirty absolute URL */
    $abs = $host . $path . '/' . $relative_link;
    /* replace '//' or '/./' or '/foo/../' with '/' */
    $re = array('#(/\\.?/)#', '#/(?!\\.\\.)[^/]+/\\.\\./#');
    for ($n = 1; $n > 0; $abs = preg_replace($re, '/', $abs, -1, $n)) {
    }
    /* absolute URL is ready! */
    return $scheme . '://' . $abs;
}
开发者ID:akoenig,项目名称:wallabag,代码行数:31,代码来源:pochePictures.php


示例6: cap_redirect_short_urls

/**
 * This function handles the actual redirection to the target.
 */
function cap_redirect_short_urls()
{
    global $post;
    if (is_singular('cap_short_urls')) {
        // Check for the existance of legacy url information. Lead with that if present.
        if (get_post_meta($post->ID, 'legacy_url_redirect_target', true)) {
            $legacy_url = get_post_meta($post->ID, 'legacy_url_redirect_target', true);
            // Let's get the actual domain from the legacy url...
            $parse = parse_url($legacy_url);
            $domain = $parse['host'];
            // ... if it is thinkprogress.org then proceed with idenfication of the post targeted. Otherwise just do a straight up redirect.
            if ('thinkprogress.org' === $domain || 'www.thinkprogress.org' === $domain) {
                // We could probably just get away with passing the old url in however... we want to make sure that if in the future the target posts permalink is changed then this short url will still work. So to that end we're going to use url_to_postid() to get the ID of the target post to past into get_permalink().
                $post_id = url_to_postid($legacy_url);
                $target = get_permalink($post_id);
                // This will add the ID of the short url post to the target post so that the get_shortlink function will work. It will only do so once bc it checks for unique existence.
                add_post_meta($post_id, 'post_short_url_target', '' . $post->ID . '', true);
            } else {
                $target = $legacy_url;
            }
        } elseif (get_post_meta($post->ID, 'url_redirect_target', true)) {
            $target = get_post_meta($post->ID, 'url_redirect_target', true);
        } elseif (get_post_meta($post->ID, 'post_redirect_target', true)) {
            $target = get_permalink(get_post_meta($post->ID, 'post_redirect_target', true));
        } else {
            $target = get_bloginfo('url');
        }
        wp_redirect($target);
        exit;
        echo '<!--Short URL Away-->';
    }
}
开发者ID:amprog,项目名称:cap-short-urls,代码行数:35,代码来源:cap-url-shortener.php


示例7: getCurrentUri

 /**
  * Gets current URI without provided query parameters
  *
  * @param array $removeParameters
  *
  * @return string
  */
 public function getCurrentUri(array $removeParameters = array())
 {
     if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
         $protocol = 'https://';
     } else {
         $protocol = 'http://';
     }
     $currentUri = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $parts = parse_url($currentUri);
     $port = isset($parts['port']) && ($protocol === 'http://' && $parts['port'] !== 80 || $protocol === 'https://' && $parts['port'] !== 443) ? ':' . $parts['port'] : '';
     if (empty($parts['query'])) {
         $query = '';
     } elseif (count($removeParameters) === 0) {
         $query = '?' . $parts['query'];
     } else {
         $queryParameters = array();
         foreach ($this->parseHttpQuery($parts['query']) as $key => $value) {
             if (!in_array($key, $removeParameters)) {
                 $queryParameters[$key] = $value;
             }
         }
         if (count($queryParameters) > 0) {
             $query = '?' . http_build_query($queryParameters, null, '&');
         } else {
             $query = '';
         }
     }
     return $protocol . $parts['host'] . $port . $parts['path'] . $query;
 }
开发者ID:henrikroosmann,项目名称:lib-wallet-php-client,代码行数:36,代码来源:RequestInfo.php


示例8: getContent

 /**
  * {@inheritDoc}
  */
 public function getContent($url)
 {
     $info = parse_url($url);
     $hostname = $info['host'];
     $port = isset($info['port']) ? $info['port'] : 80;
     $path = isset($info['path']) ? $info['path'] : '/';
     $socketHandle = $this->createSocket($hostname, $port, 30);
     if (!fwrite($socketHandle, $this->buildHttpRequest($path, $hostname))) {
         throw new ExtensionNotLoadedException('Could not send the request');
     }
     $httpResponse = $this->getParsedHttpResponse($socketHandle);
     if ($httpResponse['headers']['status'] === 301 && isset($httpResponse['headers']['location'])) {
         if (--$this->redirectsRemaining) {
             return $this->getContent($httpResponse['headers']['location']);
         } else {
             throw new HttpException('Too Many Redirects');
         }
     } else {
         $this->redirectsRemaining = self::MAX_REDIRECTS;
     }
     if ($httpResponse['headers']['status'] !== 200) {
         throw new HttpException(sprintf('The server return a %s status.', $httpResponse['headers']['status']));
     }
     return $httpResponse['content'];
 }
开发者ID:socloz,项目名称:geocoder,代码行数:28,代码来源:SocketHttpAdapter.php


示例9: getPath

 /** {@inheritDoc} */
 public function getPath()
 {
     if (!($requestPath = $this->getServerVar("REQUEST_URI")) && !($requestPath = $this->getServerVar("ORIG_PATH_INFO"))) {
         $requestPath = $this->getIisRequestUri();
     }
     return "/" . trim(rawurldecode(strval(parse_url($requestPath, PHP_URL_PATH))), "/");
 }
开发者ID:brickoo,项目名称:components,代码行数:8,代码来源:HttpRequestUriAggregator.php


示例10: prepareExtract

 public function prepareExtract()
 {
     $request_uri = isset($_GET['REQUEST_URI']) ? $_GET['REQUEST_URI'] : (isset($_POST['REQUEST_URI']) ? $_POST['REQUEST_URI'] : (isset($_ENV['REQUEST_URI']) ? $_ENV['REQUEST_URI'] : getenv("REQUEST_URI")));
     if (substr($request_uri, 0, 1) != "/") {
         $request_uri = "/" . $request_uri;
     }
     $request_uri = trim($request_uri);
     $url = "http" . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? "s" : "") . "://" . getenv("HTTP_HOST") . $request_uri;
     // parse entire url
     $parsed_url = @parse_url($url);
     // validate query parameter
     if (is_array($parsed_url) && array_key_exists('query', $parsed_url) && $parsed_url['query']) {
         $parsed_query_arr = null;
         parse_str($parsed_url['query'], $parsed_query_arr);
         $_GET = $parsed_query_arr ? $parsed_query_arr : array();
     }
     // superglobal arrays
     $superglobals = array("_COOKIE" => $_COOKIE, "_GET" => $_GET, "_POST" => $_POST, "_FILES" => $_FILES, "_ENV" => $_ENV, "_SERVER" => $_SERVER);
     // set default
     // merge superglobals arrays
     foreach ($superglobals as $key => $super_array) {
         // set internal data from superglobal arrays
         $this->{$key} = self::prepareSuperglobal($super_array);
     }
     return false;
 }
开发者ID:floxim,项目名称:floxim,代码行数:26,代码来源:Input.php


示例11: readUrl

 function readUrl($url)
 {
     var_dump($url);
     die;
     $urldata = parse_url($url);
     if (isset($urldata['host'])) {
         if ($this->host and $this->host != $urldata['host']) {
             return false;
         }
         $this->protocol = $urldata['scheme'];
         $this->host = $urldata['host'];
         $this->path = $urldata['path'];
         return $url;
     }
     if (preg_match('#^/#', $url)) {
         $this->path = $urldata['path'];
         return $this->protocol . '://' . $this->host . $url;
     } else {
         if (preg_match('#/$#', $this->path)) {
             return $this->protocol . '://' . $this->host . $this->path . $url;
         } else {
             if (strrpos($this->path, '/') !== false) {
                 return $this->protocol . '://' . $this->host . substr($this->path, 0, strrpos($this->path, '/') + 1) . $url;
             } else {
                 return $this->protocol . '://' . $this->host . '/' . $url;
             }
         }
     }
 }
开发者ID:kd-brinex,项目名称:kd,代码行数:29,代码来源:Parser.php


示例12: displayTemplateCallback

 function displayTemplateCallback($hookName, $args)
 {
     $templateMgr =& $args[0];
     $template =& $args[1];
     if ($template != 'article/article.tpl') {
         return false;
     }
     // Determine the query terms to use.
     $queryVariableNames = array('q', 'p', 'ask', 'searchfor', 'key', 'query', 'search', 'keyword', 'keywords', 'qry', 'searchitem', 'kwd', 'recherche', 'search_text', 'search_term', 'term', 'terms', 'qq', 'qry_str', 'qu', 's', 'k', 't', 'va');
     $this->queryTerms = array();
     if (($referer = getenv('HTTP_REFERER')) == '') {
         return false;
     }
     $urlParts = parse_url($referer);
     if (!isset($urlParts['query'])) {
         return false;
     }
     $queryArray = explode('&', $urlParts['query']);
     foreach ($queryArray as $var) {
         $varArray = explode('=', $var);
         if (in_array($varArray[0], $queryVariableNames) && !empty($varArray[1])) {
             $this->queryTerms += $this->parse_quote_string($varArray[1]);
         }
     }
     if (empty($this->queryTerms)) {
         return false;
     }
     $templateMgr->addStylesheet(Request::getBaseUrl() . '/' . $this->getPluginPath() . '/sehl.css');
     $templateMgr->register_outputfilter(array(&$this, 'outputFilter'));
     return false;
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:31,代码来源:SehlPlugin.inc.php


示例13: artxUrlToHref

 function artxUrlToHref($url)
 {
     $result = '';
     $p = parse_url($url);
     if (isset($p['scheme']) && isset($p['host'])) {
         $result = $p['scheme'] . '://';
         if (isset($p['user'])) {
             $result .= $p['user'];
             if (isset($p['pass'])) {
                 $result .= ':' . $p['pass'];
             }
             $result .= '@';
         }
         $result .= $p['host'];
         if (isset($p['port'])) {
             $result .= ':' . $p['port'];
         }
         if (!isset($p['path'])) {
             $result .= '/';
         }
     }
     if (isset($p['path'])) {
         $result .= $p['path'];
     }
     if (isset($p['query'])) {
         $result .= '?' . str_replace('&', '&amp;', $p['query']);
     }
     if (isset($p['fragment'])) {
         $result .= '#' . $p['fragment'];
     }
     return $result;
 }
开发者ID:skyview059,项目名称:e-learning-website,代码行数:32,代码来源:functions.php


示例14: _init_env

 private function _init_env()
 {
     error_reporting(E_ERROR);
     define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
     // ' " \ NULL 等字符转义 当magic_quotes_gpc=On的时候,函数get_magic_quotes_gpc()就会返回1
     define('GZIP', function_exists('ob_gzhandler'));
     // ob 缓存压缩输出
     if (function_exists('date_default_timezone_set')) {
         @date_default_timezone_set('Etc/GMT-8');
         //东八区 北京时间
     }
     define('TIMESTAMP', time());
     if (!defined('BLOG_FUNCTION') && !@(include BLOG_ROOT . '/source/functions.php')) {
         exit('functions.php is missing');
     }
     define('IS_ROBOT', checkrobot());
     global $_B;
     $_B = array('uid' => 0, 'username' => '', 'groupid' => 0, 'timestamp' => TIMESTAMP, 'clientip' => $this->_get_client_ip(), 'mobile' => '', 'agent' => '', 'admin' => 0);
     checkmobile();
     $_B['PHP_SELF'] = bhtmlspecialchars($this->_get_script_url());
     $_B['basefilename'] = basename($_B['PHP_SELF']);
     $sitepath = substr($_B['PHP_SELF'], 0, strrpos($_B['PHP_SELF'], '/'));
     $_B['siteurl'] = bhtmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . $sitepath . '/');
     getReferer();
     $url = parse_url($_B['siteurl']);
     $_B['siteroot'] = isset($url['path']) ? $url['path'] : '';
     $_B['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
     $this->b =& $_B;
 }
开发者ID:jammarmalade,项目名称:blog,代码行数:29,代码来源:jam_application.php


示例15: pushMobileNotification

function pushMobileNotification($msg, $displayname, $channel, $senderid)
{
    global $pushAPIKey;
    global $notificationName;
    global $cookiefile;
    $msg = checkEmoji($msg);
    if (CROSS_DOMAIN == 1) {
        $host = parse_url(BASE_URL);
        $hostname = $host['host'] ? $host['host'] : array_shift(explode('/', $host['path'], 2));
    } else {
        $hostname = $_SERVER['HTTP_HOST'];
    }
    /********************************** SETUP **********************************/
    $key = $pushAPIKey;
    $channel = $hostname . '' . $channel;
    $message = $displayname . ': ' . $msg;
    $title = $notificationName;
    $vibrate = true;
    $sound = 'default';
    $icon = 'push_appicon_29da38bf54';
    $to_ids = "everyone";
    $json = '{"badge":"1","alert":"' . $message . '","title":"' . $title . '","vibrate":' . $vibrate . ',"sound":"' . $sound . '","icon": "' . $icon . '", "id":"' . $senderid . '" ,"name":"' . $displayname . '", "type":"chatbox"}';
    if (!isset($_SESSION['cometchat']['pushNotificationSessionid'])) {
        loginPushNotification();
    }
    /********************************** SEND PUSH **********************************/
    $url = "https://api.cloud.appcelerator.com/v1/push_notification/notify.json?key=" . $key;
    $params = "channel=" . $channel . "&payload=" . $json . "&to_ids={$to_ids}";
    $response = checkcURL(0, $url, $params, 1, $cookiefile);
}
开发者ID:rodino25,项目名称:tsv2,代码行数:30,代码来源:sendnotification.php


示例16: SOAP_Transport_TCP

 /**
  * Constructor.
  *
  * @param string $url  HTTP url to SOAP endpoint.
  *
  * @access public
  */
 function SOAP_Transport_TCP($url, $encoding = SOAP_DEFAULT_ENCODING)
 {
     parent::SOAP_Base_Object('TCP');
     $this->urlparts = @parse_url($url);
     $this->url = $url;
     $this->encoding = $encoding;
 }
开发者ID:prometheus-ev,项目名称:promdilps,代码行数:14,代码来源:TCP.php


示例17: SpamCheckDNSBL

function SpamCheckDNSBL($bl, $link)
{
    $obj = new DNSBL();
    $obj->setWhiteList($obj->getConfig(CONFIG_SPAM_WL_SKIP_DOMAIN));
    if (empty($bl) || !is_array($bl)) {
        $obj->setBlockList($obj->getConfig(CONFIG_SPAM_BLOCKLIST, 'HOST'));
    } else {
        $obj->setBlockList($bl);
    }
    $obj->setMyNetList($obj->getConfig(CONFIG_SPAM_WL_PRIVATE_NET, 'HOST'));
    $hosts = !is_array($link) ? array($link) : $link;
    $i = 0;
    foreach ($hosts as $host) {
        $url = parse_url($host);
        $domain = empty($url['host']) ? $host : $url['host'];
        $obj->setName($domain);
        if ($obj->isListed()) {
            return true;
        }
        if (SPAM_MAX_COUNTER == 0) {
            continue;
        }
        $i++;
        if ($i > SPAM_MAX_COUNTER) {
            return false;
        }
    }
    return false;
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:29,代码来源:spamplus.php


示例18: additional_info

 /**
  * Get contact information
  * @since 2.6.1
  * @access public
  */
 public function additional_info()
 {
     $contact_info = explode(',', $this->args['additional_info']);
     $output = '<div id="gmw-sl-additional-info-wrapper-' . $this->args['element_id'] . '" class="gmw-sl-additional-info-wrapper gmw-sl-' . $this->args['item_type'] . '-additional-info-wrapper">';
     $this->item_info->address = !empty($this->item_info->formatted_address) ? $this->item_info->formatted_address : $this->item_info->address;
     $output .= '<ul>';
     foreach ($contact_info as $info) {
         $label = !empty($this->labels[$info . '_label']) ? $this->labels[$info . '_label'] : $info;
         if ($info == 'website' && !empty($this->item_info->website)) {
             $url = parse_url($this->item_info->website);
             if (empty($url['scheme'])) {
                 $url['scheme'] = 'http';
             }
             $scheme = $url['scheme'] . '://';
             $path = str_replace($scheme, '', $this->item_info->website);
             $website = '<a href="' . $scheme . $path . '" title="' . $path . '" target="_blank">' . $path . '</a>';
             $output .= "<li class=\"gmw-{$info} {$info}\"><span class=\"label\">{$label}</span>: ";
             $output .= !empty($this->item_info->{$info}) ? $website : $this->labels['na'];
             $output .= '</li>';
         } elseif ($info == 'email' && !empty($this->item_info->email)) {
             $output .= "<li class=\"gmw-{$info} {$info}\"><span class=\"label\">{$label}</span>: ";
             $output .= !empty($this->item_info->{$info}) ? "<a href=\"mailto:{$this->item_info->email}\">{$this->item_info->email}</a>" : $this->labels['na'];
             $output .= '</li>';
         } else {
             $output .= "<li class=\"gmw-{$info} {$info}\"><i class=\"fa fa-{$label}\"></i><span class=\"label\">{$label}</span>: ";
             $output .= !empty($this->item_info->{$info}) ? $this->item_info->{$info} : $this->labels['na'];
             $output .= '</li>';
         }
     }
     $output .= '</li>';
     $output .= '</div>';
     return apply_filters('gmw_sl_additional_info', $output, $this->args, $this->item_info, $this->user_position);
 }
开发者ID:sedici,项目名称:wpmu-istec,代码行数:38,代码来源:gmw-pt-single-post-location-class.php


示例19: get

 /**
  * Get stored cookies for a url.
  *
  * Finds matching stored cookies and returns a simple array
  * of name => value
  *
  * @param string $url The url to find cookies for.
  * @return array
  */
 public function get($url)
 {
     $path = parse_url($url, PHP_URL_PATH) ?: '/';
     $host = parse_url($url, PHP_URL_HOST);
     $scheme = parse_url($url, PHP_URL_SCHEME);
     $out = [];
     foreach ($this->_cookies as $cookie) {
         if ($scheme === 'http' && !empty($cookie['secure'])) {
             continue;
         }
         if (strpos($path, $cookie['path']) !== 0) {
             continue;
         }
         $leadingDot = $cookie['domain'][0] === '.';
         if (!$leadingDot && $host !== $cookie['domain']) {
             continue;
         }
         if ($leadingDot) {
             $pattern = '/' . preg_quote(substr($cookie['domain'], 1), '/') . '$/';
             if (!preg_match($pattern, $host)) {
                 continue;
             }
         }
         $out[$cookie['name']] = $cookie['value'];
     }
     return $out;
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:36,代码来源:CookieCollection.php


示例20: getPostString

 protected static function getPostString($filepath, $url, $mediafile, $to, $from)
 {
     $host = parse_url($url, PHP_URL_HOST);
     //filename to md5 digest
     $cryptoname = md5($filepath) . "." . $mediafile['fileextension'];
     $boundary = "zzXXzzYYzzXXzzQQ";
     $contentlength = 0;
     $hBAOS = "--" . $boundary . "\r\n";
     $hBAOS .= "Content-Disposition: form-data; name=\"to\"\r\n\r\n";
     $hBAOS .= $to . "\r\n";
     $hBAOS .= "--" . $boundary . "\r\n";
     $hBAOS .= "Content-Disposition: form-data; name=\"from\"\r\n\r\n";
     $hBAOS .= $from . "\r\n";
     $hBAOS .= "--" . $boundary . "\r\n";
     $hBAOS .= "Content-Disposition: form-data; name=\"file\"; filename=\"" . $cryptoname . "\"\r\n";
     $hBAOS .= "Content-Type: " . $mediafile['filemimetype'] . "\r\n\r\n";
     $fBAOS = "\r\n--" . $boundary . "--\r\n";
     $contentlength += strlen($hBAOS);
     $contentlength += strlen($fBAOS);
     $contentlength += $mediafile['filesize'];
     $POST = "POST " . $url . "\r\n";
     $POST .= "Content-Type: multipart/form-data; boundary=" . $boundary . "\r\n";
     $POST .= "Host: " . $host . "\r\n";
     $POST .= "User-Agent: WhatsApp/2.3.53 S40Version/14.26 Device/Nokia302\r\n";
     $POST .= "Content-Length: " . $contentlength . "\r\n\r\n";
     return self::sendData($host, $POST, $hBAOS, $filepath, $mediafile, $fBAOS);
 }
开发者ID:abazad,项目名称:whatsappGUI,代码行数:27,代码来源:mediauploader.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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