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


PHP is_url函数代码示例

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


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

示例1: update_action

 public function update_action()
 {
     if (!$this->input->is_ajax_request()) {
         show_404();
     }
     $name = $this->input->post('name', true);
     $link = $this->input->post('link', true);
     $info = $this->input->post('info', true);
     $sort = (int) $this->input->post('sort');
     $data['name'] = trim($name);
     $data['link'] = $link;
     $data['info'] = substring(format_content($info), 240);
     $data['sort'] = $sort > 255 ? 255 : $sort;
     if (!$data['name'] or !$data['link']) {
         JSON('error', '对不起,请填写必填字段!');
     }
     if (!is_url($data['link'])) {
         JSON('error', '请填写有效的网站 URL 地址!');
     }
     $lid = (int) $this->input->post('lid');
     $this->db->update('link', $data, array('lid' => $lid));
     if ($this->db->affected_rows()) {
         JSON('success', '恭喜,链接已更新成功!');
     } else {
         JSON('error', '对不起,链接没有更新名更新失败!');
     }
 }
开发者ID:ruoL,项目名称:fun-x,代码行数:27,代码来源:link.php

示例2: plugin_siteimage_convert

function plugin_siteimage_convert()
{
    global $link_target;
    $args = func_get_args();
    $url = array_shift($args);
    if (!is_url($url)) {
        return '<p>Usage: #siteimage([url],[option(s),...]);</p>';
    }
    $options = array('nolink' => false, 'around' => false, 'left' => false, 'right' => false, 'center' => false);
    get_plugin_option($args, &$options);
    $style = 'width:128px;height:128px;margin:10px;';
    if ($options['around']) {
        if ($options['right']) {
            $style .= 'float:right;margin-right:5px;';
        } else {
            $style .= 'float:left;margin-left:5px;';
        }
    } else {
        if ($options['right']) {
            $style .= 'margin-right:10px;margin-left:auto;';
        } else {
            if ($options['center']) {
                $style .= 'margin-right:auto;margin-left:auto;';
            } else {
                $style .= 'margin-right:auto;margin-left:10px;';
            }
        }
    }
    //	$img = plugin_siteimage_make($url, $options['nolink'], $options['target']);
    $img = plugin_siteimage_make($url, $options['nolink']);
    return '<div style="' . $style . '">' . $img . "</div>\n";
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:32,代码来源:siteimage.inc.php

示例3: pass

 function pass($post)
 {
     if (!is_array($post)) {
         return false;
     }
     if (!$post['catid']) {
         return $this->_(lang('message->pass_catid'));
     }
     if (strlen($post['title']) < 3) {
         return $this->_(lang('message->pass_title'));
     }
     if (!is_url($post['thumb'])) {
         return $this->_(lang('message->pass_thumb'));
     }
     if (!$post['password'] && $post['open'] == 2) {
         return $this->_(lang('photo->pass_password'));
     }
     if (!$post['question'] && $post['open'] == 1) {
         return $this->_(lang('photo->pass_question'));
     }
     if (!$post['answer'] && $post['open'] == 1) {
         return $this->_(lang('photo->pass_answer'));
     }
     if (DT_MAX_LEN && strlen($post['content']) > DT_MAX_LEN) {
         return $this->_(lang('message->pass_max'));
     }
     return true;
 }
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:28,代码来源:photo.class.php

示例4: parse

 /** @return array of VcardAddress objects */
 static function parse($data)
 {
     if (is_url($data)) {
         $http = new HttpClient($data);
         $data = $http->getBody();
         //FIXME check http client return code for 404
         if (strpos($data, 'BEGIN:VCARD') === false) {
             throw new \Exception('VcardReader->parse FAIL: cant parse vcard from ' . $http->getUrl());
             return false;
         }
     }
     $res = array();
     do {
         $m1 = 'BEGIN:VCARD';
         $m2 = 'END:VCARD';
         $p1 = strpos($data, $m1);
         $p2 = strpos($data, $m2);
         if ($p1 === false || $p2 === false) {
             break;
         }
         $part = substr($data, $p1, $p2 - $p1 + strlen($m2));
         $res[] = self::parseVcard($part);
         $data = substr($data, $p2 + strlen($m2));
     } while ($data);
     return $res;
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:27,代码来源:VcardReader.php

示例5: plugin_conversion_inline

function plugin_conversion_inline()
{
    global $vars, $script;
    $qm = get_qm();
    $page = isset($vars['page']) ? $vars['page'] : '';
    $args = func_get_args();
    if (count($args) != 5) {
        return $qm->replace('fmt_err_iln', 'conversion', $qm->m['plg_conversion']['err_usage_iln']);
    }
    $text = array_pop($args);
    list($step, $group, $name, $url) = $args;
    if (!is_url($url)) {
        return $qm->replace('fmt_err_iln', 'conversion', $qm->m['plg_conversion']['err_url']);
    }
    $raw_url = $url;
    $step = rawurlencode($step);
    $group = rawurlencode($group);
    $name = rawurlencode($name);
    $url = rawurlencode($url);
    $dest = $script . '?cmd=conversion&mode=link&step=' . $step . '&group=' . $group . '&name=' . $name . '&url=' . $url;
    //edit auth check
    $editable = edit_auth($page, FALSE, FALSE);
    if ($editable) {
        return '<a href="' . $dest . '">' . $text . '</a><span style="font-size:11px;background-color:#fdd">←' . $qm->m['plg_conversion']['ntc_admin'] . '</span>';
    } else {
        return '<a href="' . $dest . '">' . $text . '</a>';
    }
}
开发者ID:big2men,项目名称:qhm,代码行数:28,代码来源:conversion.inc.php

示例6: plugin_redirect_iframe_convert

function plugin_redirect_iframe_convert()
{
    global $vars, $script;
    $qm = get_qm();
    $page = isset($vars['page']) ? $vars['page'] : '';
    $args = func_get_args();
    $url = strip_autolink(array_pop($args));
    if ($url == '') {
        $url = $script . '?' . rawurlencode($page);
    } else {
        $url = is_url($url) ? $url : $script . '?' . rawurlencode($url);
    }
    $editable = ss_admin_check();
    if ($editable) {
        return $qm->replace('plg_redirect_iframe.ntc_admin', $url);
    } else {
        return <<<EOD
<span id="redirect_iframe_msg"><p style="color:gray"><a href="{$url}" target="new">{$qm->m['plg_redirect_iframe']['link']}</a></p></span>
<script type="text/javascript">
<!--
if(parent != self){
parent.location.href="{$url}";
}
else{
var element = document.getElementById("redirect_iframe_msg");
element.innerHTML = "";
}

//-->
</script>
EOD;
    }
}
开发者ID:big2men,项目名称:qhm,代码行数:33,代码来源:redirect_iframe.inc.php

示例7: plugin_ga_link_inline

function plugin_ga_link_inline()
{
    global $accesstag_moved;
    global $accesstag;
    global $vars;
    $qm = get_qm();
    $qt = get_qt();
    $page = isset($vars['page']) ? $vars['page'] : '';
    //parameter check
    $args = func_get_args();
    $num = func_num_args();
    if ($num != 2) {
        return $qm->replace('fmt_err_iln', 'ga_link', $qm->m['plg_ga_link']['err_usage']);
    }
    $text = strip_autolink(array_pop($args));
    //テキストデータ
    $url = array_pop($args);
    if (!is_url($url)) {
        $url = 'index.php?' . rawurlencode($url);
    }
    $acc_tag = '';
    //初めて呼び出される場合、accesstag情報を表示する
    if (!$accesstag_moved) {
        $accesstag_moved = TRUE;
        //accesstag_movedを設定
        $editable = edit_auth($page, FALSE, FALSE);
        if (!$editable) {
            $qt->setv('toolkit_upper', $accesstag);
        }
    }
    //Google Analytics用のjavascriptを先に読み込んでから、関数を呼び出す
    $ret = '<a href="index.php?cmd=ga_link&url=' . rawurlencode($url) . '" onClick="javascript:pageTracker._link(this.href);return false;">' . $text . '</a>';
    return $ret;
}
开发者ID:big2men,项目名称:qhm,代码行数:34,代码来源:ga_link.inc.php

示例8: plugin_a_inline

/**
 * PukiWiki Plus! Anchor Plugin
 *
 * @copyright   Copyright &copy; 2008, Katsumi Saito <katsumi@jo1upk.ymt.prug.or.jp>
 * @version     $Id: a.inc.php,v 0.2 2008/02/24 18:47:00 upk Exp $
 * @license     http://opensource.org/licenses/gpl-license.php GNU Public License (GPL2)
 *
 */
function plugin_a_inline()
{
    global $_symbol_innanchor, $_symbol_extanchor;
    list($href, $name, $opt) = func_get_args();
    $href = trim($href);
    if (empty($href)) {
        return;
    }
    $name = trim($name);
    if (empty($name)) {
        $name = $href;
    }
    $opt = trim($opt);
    if (!empty($opt)) {
        $opt = ' ' . $opt;
    }
    $is_url = is_url($href);
    if (!$is_url && !a_rel_check($href)) {
        return $href;
    }
    $is_ext = $is_url && !is_inside_uri($href);
    $symbol = $is_ext ? $_symbol_extanchor : $_symbol_innanchor;
    $r_href = PKWK_USE_REDIRECT && $is_ext ? get_cmd_uri('redirect', '', '', 'u=') . rawurlencode($href) : htmlspecialchars($href);
    if (!$is_url) {
        return '<a href="' . $r_href . '"' . $opt . '>' . $name . '</a>';
    } else {
        return '<a class="inn" href="' . $r_href . '" rel="nofollow"' . $opt . '>' . $name . str_replace('$1', $r_href, str_replace('$2', '_blank', $symbol)) . '</a>';
    }
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:37,代码来源:a.inc.php

示例9: convert

 function convert()
 {
     if (func_num_args() == 0) {
         return '<p>$this->plugin(): no argument(s). </p>';
     }
     global $vars;
     $args = func_get_args();
     $url = array_shift($args);
     if (!is_url($url) && is_interwiki($url)) {
         list($interwiki, $page) = explode(':', $url, 2);
         $url = get_interwiki_url($interwiki, $page);
     }
     $page = $vars['page'];
     if (!(PKWK_READONLY > 0 or is_freeze($page) or $this->is_edit_auth($page))) {
         if (!$this->accept($url)) {
             return "<p>{$this->plugin}(): The specified url, {$url}, is not allowed, modify iframe.inc.php<br />" . "Or, restrict editing of current page using freeze or edit_auth or PKWK_READONLY.</p>";
         }
     }
     $url = htmlspecialchars($url);
     $options = array();
     foreach ($args as $arg) {
         list($key, $val) = array_pad(explode('=', $arg, 2), 2, TRUE);
         $options[$key] = htmlspecialchars($val);
     }
     $style = isset($options['style']) ? $options['style'] : NULL;
     if (preg_match("/MSIE (3|4|5|6|7)/", getenv("HTTP_USER_AGENT"))) {
         $style = isset($options['iestyle']) ? $options['iestyle'] : $style;
         return $this->show_iframe($url, $style);
     } else {
         return $this->show_object($url, $style);
     }
 }
开发者ID:orangeal2o3,项目名称:pukiwiki-plugin,代码行数:32,代码来源:iframe.inc.php

示例10: parse

 function parse($raw)
 {
     // TODO XmlReader should not handle HTTP protocol details
     if (is_url($raw)) {
         $url = $raw;
         $h = new HttpClient($url);
         //            $h->setCacheTime('30m');
         $raw = $h->getBody();
         //            d( $h->getResponseHeaders() );
         if ($h->getStatus() == 404) {
             // not found
             return false;
         }
         if ($h->getStatus() == 302) {
             $redir = $h->getResponseHeader('location');
             // echo "REDIRECT: ".$redir."\n";
             $h = new HttpClient($redir);
             //XXX: reuse previous client?
             $h->setCacheTime('30m');
             $url = $redir;
             $raw = $h->getBody();
         }
         // prepend XML header if nonexistent
         if (strpos($raw, '<?xml ') === false) {
             $raw = '<?xml version="1.0"?>' . $raw;
         }
     }
     if (!$this->xml($raw)) {
         if (isset($url)) {
             throw new \Exception("Failed to parse XML from " . $url);
         }
         throw new \Exception("Failed to parse XML");
     }
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:34,代码来源:XmlReader.php

示例11: plugin_html2pdf_get_request_uri

function plugin_html2pdf_get_request_uri($init_uri = '')
{
    if ($init_uri == '') {
        // Set automatically
        $msg = 'get_request_uri() failed: Please set $script at INI_FILE manually';
        if (isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI'][0] == '/') {
            $url = SERVER_PORT == 443 ? 'https://' : 'http://';
            // scheme
            $url .= SERVER_NAME;
            // host
            $url .= SERVER_PORT == 80 ? '' : ':' . SERVER_PORT;
            // port
            $url .= $_SERVER['REQUEST_URI'];
        } else {
            global $vars;
            $url = get_script_uri() . '?';
            $queries = array();
            $queries[] = $vars['cmd'] != '' ? 'cmd=' . rawurlencode($vars['cmd']) : '';
            $queries[] = $vars['page'] != '' ? 'page=' . rawurlencode($vars['page']) : '';
            $url .= implode('&', $queries);
        }
        if (!is_url($url, TRUE)) {
            die_message($msg);
        }
    } else {
        // Set manually
        if (!is_url($init_uri, TRUE)) {
            die_message('$url: Invalid URI');
        }
        $url = $init_uri;
    }
    return $url;
}
开发者ID:orangeal2o3,项目名称:pukiwiki-plugin,代码行数:33,代码来源:html2pdf.inc.php

示例12: plugin_canonical_convert

/**
 *   Canonical URL modifier Plugin
 *   -------------------------------------------
 *   /haik-contents/plugin/canonical.inc.php
 *
 *   Copyright (c) 2014 hokuken
 *   http://hokuken.com/
 *
 *   created  : 14/12/10
 *   modified :
 *
 *   ページの canonical URL を任意のものに設定できる
 *
 *   Usage :
 *   #canonical(URL or pagename or path)
 *
 */
function plugin_canonical_convert()
{
    global $script, $vars;
    // Deny the call at layout pages
    if (isset($vars['page_alt'])) {
        return;
    }
    $qt = get_qt();
    if (func_num_args() === 0) {
        return;
    }
    $target = func_get_arg(0);
    // URL
    if (is_url($target)) {
        $canonical_url = $target;
    } else {
        if (is_page($target)) {
            $canonical_url = $script . '?' . rawurlencode($target);
        } else {
            $base_dir = dirname($script . 'dummy');
            $canonical_url = $base_dir . '/' . $target;
        }
    }
    $qt->setv('canonical_url', $canonical_url);
    return plugin_canonical_show_info();
}
开发者ID:big2men,项目名称:qhm,代码行数:43,代码来源:canonical.inc.php

示例13: plugin_ganatracker2_inline

function plugin_ganatracker2_inline()
{
    global $accesstag_moved;
    global $accesstag;
    global $vars;
    $qm = get_qm();
    $page = isset($vars['page']) ? $vars['page'] : '';
    //parameter check
    $args = func_get_args();
    $num = func_num_args();
    if ($num != 3) {
        return $qm->replace('fmt_err_iln', 'ganatracker2', $qm->m['plg_ganatracker2']['err_usage_iln']);
    }
    $text = strip_autolink(array_pop($args));
    //テキストデータ
    $tname = array_pop($args);
    $url = array_pop($args);
    if (!is_url($url)) {
        $url = 'index.php?' . rawurlencode($url);
    }
    $acc_tag = '';
    //初めて呼び出される場合、accesstag情報を表示する
    if (!$accesstag_moved) {
        $acc_tag = $accesstag;
        $accesstag_moved = 1;
        //accesstag_movedを設定
    }
    $ret = $acc_tag . '<a href="' . $url . '" onClick="javascript:pageTracker._trackPageview(\'' . $tname . '\');">' . $text . '</a>';
    $editable = edit_auth($page, FALSE, FALSE);
    if ($editable) {
        return '<div style="border:2px dashed #f00;background-color:#fee;margin:1em">' . $ret . '<br />' . $qm->replace('plg_ganatracker2.ntc_admin', $tname) . '</div>';
    } else {
        return $ret;
    }
}
开发者ID:big2men,项目名称:qhm,代码行数:35,代码来源:ganatracker2.inc.php

示例14: fetch_blacklist

function fetch_blacklist()
{
    global $config, $g;
    $url = $config['installedpackages']['dansguardianblacklist']['config'][0]['url'];
    if (is_url($url)) {
        conf_mount_rw();
        print "file download start..";
        unlink_if_exists("/usr/local/etc/dansguardian/lists/blacklist.tgz");
        exec("/usr/bin/fetch -o /usr/local/etc/dansguardian/lists/blacklist.tgz " . escapeshellarg($url));
        chdir("/usr/local/etc/dansguardian/lists");
        if (is_dir("blacklists.old")) {
            exec('rm -rf /usr/local/etc/dansguardian/lists/blacklists.old');
        }
        rename("blacklists", "blacklists.old");
        exec('/usr/bin/tar -xvzf /usr/local/etc/dansguardian/lists/blacklist.tgz 2>&1', $output, $return);
        if (preg_match("/x\\W+(\\w+)/", $output[0], $matches)) {
            if ($matches[1] != "blacklists") {
                rename("./" . $matches[1], "blacklists");
            }
            read_lists();
        } else {
            file_notice("Dansguardian - Could not determine Blacklist extract dir. Categories not updated", "");
        }
    } else {
        file_notice("Dansguardian - Blacklist url is invalid.", "");
    }
}
开发者ID:nagyrobi,项目名称:pfsense-packages,代码行数:27,代码来源:dansguardian.php

示例15: get_video_object

function get_video_object($article)
{
    $video = new StdClass();
    $video->file = '';
    $video->image = '';
    $video->provider = '';
    $params = array();
    if (is_url($article->video_attachment)) {
        if (is_youtube_video($video->file = $article->video_attachment)) {
            $video->image = extract_youtube_image($video->file);
            $video->provider = 'youtube';
            $params[] = 'provider=youtube';
        }
    } else {
        $video->file = VIVVO_STATIC_URL . $article->video_attachment;
    }
    if (!$video->image and $article->image) {
        $video->image = VIVVO_STATIC_URL . "thumbnail.php?file={$article->image}&size=article_large";
    }
    if ($video->image) {
        $params[] = 'image=' . flashvars_encode($video->image);
    }
    $params[] = 'file=' . flashvars_encode($video->file);
    $params[] = 'logo.hide=true';
    $video->flashvars = implode('&', $params);
    return $video;
}
开发者ID:ahanjir07,项目名称:vivvo-dev,代码行数:27,代码来源:video_box.modifier.php


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