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

PHP p2h函数代码示例

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

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



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

示例1: __construct

 /**
  * @param string $html
  * @param array $fallbackEncodings
  * @throws P2Exception
  */
 public function __construct($html, array $fallbackEncodings = null)
 {
     set_error_handler(array($this, 'checkConversionFailure'), E_WARNING);
     try {
         $this->_conversionFailed = false;
         $document = new DOMDocument();
         $document->loadHTML($html);
         // 代替エンコーディングを指定して再読み込み
         if ($this->_conversionFailed && $fallbackEncodings) {
             $orig_html = $html;
             foreach ($fallbackEncodings as $charset) {
                 // <head>直後に<meta>を埋め込む
                 $charset = p2h($charset);
                 $html = str_replace('<rep2:charset>', "<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$charset}\">", preg_replace('/<head[^<>]*>/i', '$0<rep2:charset>', $orig_html));
                 $this->_conversionFailed = false;
                 $document = new DOMDocument();
                 $document->loadHTML($html);
                 if (!$this->_conversionFailed) {
                     break;
                 }
             }
         }
     } catch (Exception $e) {
         restore_error_handler();
         throw new P2Exception('Failed to create DOM: ' . get_class($e) . ': ' . $e->getMessage());
     }
     restore_error_handler();
     if ($this->_conversionFailed) {
         throw new P2Exception('Failed to load HTML');
     }
     $this->_document = $document;
     $this->_xpath = new DOMXPath($document);
 }
开发者ID:xingskycn,项目名称:p2-php,代码行数:38,代码来源:P2DOM.php


示例2: wordForMatch

 /**
  * フォームから送られてきたワードをマッチ関数に適合させる
  *
  * @return string $word_fm 適合パターン。SJISで返す。
  */
 public static function wordForMatch($word, $method = 'regex')
 {
     $word_fm = $word;
     // 「そのまま」でなければ、全角空白を半角空白に矯正
     if ($method != 'just') {
         $word_fm = mb_convert_kana($word_fm, 's');
     }
     $word_fm = p2h(trim($word_fm));
     if (in_array($method, array('and', 'or', 'just'))) {
         // preg_quote()で2バイト目が0x5B("[")の"ー"なども変換されてしまうので
         // UTF-8にしてから正規表現の特殊文字をエスケープ
         $word_fm = mb_convert_encoding($word_fm, 'UTF-8', 'CP932');
         if (P2_MBREGEX_AVAILABLE == 1) {
             $word_fm = preg_quote($word_fm);
         } else {
             $word_fm = preg_quote($word_fm, '/');
         }
         $word_fm = mb_convert_encoding($word_fm, 'CP932', 'UTF-8');
         // 他、regex(正規表現)なら
     } else {
         if (P2_MBREGEX_AVAILABLE == 0) {
             $word_fm = str_replace('/', '\\/', $word_fm);
         }
     }
     return $word_fm;
 }
开发者ID:xingskycn,项目名称:p2-php,代码行数:31,代码来源:StrCtl.php


示例3: editFile

/**
 * ファイル内容を読み込んで編集する関数
 */
function editFile($path, $encode, $title)
{
    global $_conf, $modori_url, $rows, $cols, $csrfid;
    if ($path == '') {
        p2die('path が指定されていません');
    }
    $filename = basename($path);
    $ptitle = 'Edit: ' . p2h($title) . ' (' . $filename . ')';
    //ファイル内容読み込み
    FileCtl::make_datafile($path) or p2die("cannot make file. ({$path})");
    $cont = file_get_contents($path);
    if ($encode == "EUC-JP") {
        $cont = mb_convert_encoding($cont, 'CP932', 'CP51932');
    }
    $cont_area = p2h($cont);
    if ($modori_url) {
        $modori_url_ht = "<p><a href=\"{$modori_url}\">Back</a></p>\n";
    } else {
        $modori_url_ht = '';
    }
    $rows_at = $rows > 0 ? sprintf(' rows="%d"', $rows) : '';
    $cols_at = $cols > 0 ? sprintf(' cols="%d"', $cols) : '';
    // プリント
    echo $_conf['doctype'];
    echo <<<EOHEADER
<html lang="ja">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
    {$_conf['extra_headers_ht']}
    <title>{$ptitle}</title>
</head>
<body onload="top.document.title=self.document.title;">
EOHEADER;
    $info_msg_ht = P2Util::getInfoHtml();
    echo $modori_url_ht;
    echo $ptitle;
    echo <<<EOFORM
<form action="{$_SERVER['SCRIPT_NAME']}" method="post" accept-charset="{$_conf['accept_charset']}">
    <input type="hidden" name="file" value="{$filename}">
    <input type="hidden" name="modori_url" value="{$modori_url}">
    <input type="hidden" name="encode" value="{$encode}">
    <input type="hidden" name="rows" value="{$rows}">
    <input type="hidden" name="cols" value="{$cols}">
    <input type="hidden" name="csrfid" value="{$csrfid}">
    <input type="submit" name="submit" value="Save">
    {$info_msg_ht}<br>
    <textarea style="font-size:9pt;" id="filecont" name="filecont" wrap="off"{$rows_at}{$cols_at}>{$cont_area}</textarea>
    {$_conf['detect_hint_input_ht']}{$_conf['k_input_ht']}
</form>
EOFORM;
    echo '</body></html>';
    return true;
}
开发者ID:xingskycn,项目名称:p2-php,代码行数:59,代码来源:editfile.php


示例4: fetchSubjectTxt

 /**
  * subject.txtの並列ダウンロードを実行する
  *
  * @param string $mode
  * @param array $_conf
  * @return bool
  */
 public static function fetchSubjectTxt($mode, array $_conf)
 {
     // コマンド生成
     $args = array(escapeshellarg($_conf['expack.php_cli_path']));
     if ($_conf['expack.dl_pecl_http']) {
         $args[] = '-d';
         $args[] = 'extension=' . escapeshellarg('http.' . PHP_SHLIB_SUFFIX);
     }
     $args[] = escapeshellarg(P2_SCRIPT_DIR . DIRECTORY_SEPARATOR . 'fetch-subject-txt.php');
     switch ($mode) {
         case 'fav':
         case 'recent':
         case 'res_hist':
         case 'merge_favita':
             $args[] = sprintf('--mode=%s', $mode);
             break;
         default:
             return false;
     }
     if ($_conf['expack.misc.multi_favs']) {
         switch ($mode) {
             case 'fav':
                 $args[] = sprintf('--set=%d', $_conf['m_favlist_set']);
                 break;
             case 'merge_favita':
                 $args[] = sprintf('--set=%d', $_conf['m_favita_set']);
                 break;
         }
     }
     // 標準エラー出力を標準出力にリダイレクト
     $args[] = '2>&1';
     $command = implode(' ', $args);
     //P2Util::pushInfoHtml('<p>' . p2h($command) . '</p>');
     // 実行
     $pipe = popen($command, 'r');
     if (!is_resource($pipe)) {
         p2die('コマンドを実行できませんでした。', $command);
     }
     $output = '';
     while (!feof($pipe)) {
         $output .= fgets($pipe);
     }
     $status = pclose($pipe);
     if ($status != 0) {
         P2Util::pushInfoHtml(sprintf('<p>%s(): ERROR(%d)</p>', __METHOD__, $status));
     }
     if ($output !== '') {
         if ($status == 2) {
             P2Util::pushInfoHtml($output);
         } else {
             P2Util::pushInfoHtml('<p>' . nl2br(p2h($output)) . '</p>');
         }
     }
     return $status == 0;
 }
开发者ID:xingskycn,项目名称:p2-php,代码行数:62,代码来源:P2CommandRunner.php


示例5: setFavItaByRequest

/**
 * リクエストパラメータからお気に板をセットする
 *
 * @param   void
 * @return  bool
 */
function setFavItaByRequest()
{
    global $_conf;
    $setfavita = null;
    $host = null;
    $bbs = null;
    $itaj = null;
    $list = null;
    if ($_SERVER['REQUEST_METHOD'] == 'GET') {
        if (isset($_GET['setfavita'])) {
            $setfavita = $_GET['setfavita'];
        }
        if (isset($_GET['host'])) {
            $host = $_GET['host'];
        }
        if (isset($_GET['bbs'])) {
            $bbs = $_GET['bbs'];
        }
        if (isset($_GET['itaj_en'])) {
            $itaj = UrlSafeBase64::decode($_GET['itaj_en']);
        }
    } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
        if (isset($_POST['setfavita'])) {
            $setfavita = $_POST['setfavita'];
        }
        if (isset($_POST['itaj'])) {
            $itaj = $_POST['itaj'];
        }
        if (isset($_POST['url'])) {
            if (preg_match("/http:\\/\\/(.+)\\/([^\\/]+)\\/([^\\/]+\\.html?)?/", $_POST['url'], $matches)) {
                $host = $matches[1];
                $host = preg_replace('{/test/read\\.cgi$}', '', $host);
                $bbs = $matches[2];
            } else {
                $url_ht = p2h($_POST['url']);
                P2Util::pushInfoHtml("<p>p2 info: 「{$url_ht}」は板のURLとして無効です。</p>");
            }
        } elseif (!empty($_POST['submit_setfavita']) && $_POST['list']) {
            $list = $_POST['list'];
        }
    }
    if ($host && $bbs) {
        return setFavItaByHostBbs($host, $bbs, $setfavita, $itaj);
    } elseif ($list) {
        return setFavItaByList($list);
    } else {
        P2Util::pushInfoHtml("<p>p2 info: 板の指定が変です</p>");
        return false;
    }
}
开发者ID:xingskycn,项目名称:p2-php,代码行数:56,代码来源:setfavita.inc.php


示例6: fixed_name_get_select_element

/**
 * 定型文を選択するselect要素を取得する
 *
 * @param   string  $name       select要素のid属性値・兼・name属性値 (デフォルトは'fixed_message')
 * @param   string  $onchange   option要素が選択されたときのイベントハンドラ (デフォルトはなし)
 * @return  string  select要素のHTML
 */
function fixed_name_get_select_element($name = 'fixed_message', $onchange = null)
{
    $name_ht = p2h($name);
    if ($onchange !== null) {
        $onchange_ht = p2h($onchange);
        $select = "<select id=\"{$name_ht}\" name=\"{$name_ht}\" onchange=\"{$onchange_ht}\">\n";
    } else {
        $select = "<select id=\"{$name_ht}\" name=\"{$name_ht}\">\n";
    }
    $select .= "<option value=\"\">定型文</option>\n";
    foreach (fixed_message_get_persister()->getKeys() as $key) {
        $key_ht = p2h($onchange);
        $select .= "<option value=\"{$key_ht}\">{$key_ht}</option>\n";
    }
    $select .= "</option>";
    return $select;
}
开发者ID:xingskycn,项目名称:p2-php,代码行数:24,代码来源:fixed_message.inc.php


示例7: viewTxtFile

/**
 * ファイル内容を読み込んで表示する関数
 */
function viewTxtFile($file, $encode)
{
    if (!$file) {
        p2die('file が指定されていません');
    }
    $filename = basename($file);
    $ptitle = $filename;
    //ファイル内容読み込み
    $cont = FileCtl::file_read_contents(P2_BASE_DIR . DIRECTORY_SEPARATOR . $file);
    if ($cont === false) {
        $cont_area = '';
    } else {
        if (strcasecmp($encode, 'EUC-JP') === 0) {
            $cont = mb_convert_encoding($cont, 'CP932', 'CP51932');
        } elseif (strcasecmp($encode, 'UTF-8') === 0) {
            $cont = mb_convert_encoding($cont, 'CP932', 'UTF-8');
        }
        $cont_area = p2h($cont);
    }
    // プリント
    echo <<<EOHEADER
<!DOCTYPE html>
<html lang="ja">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
    {$_conf['extra_headers_ht']}
    <title>{$ptitle}</title>
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
</head>
<body onload="top.document.title=self.document.title;">

EOHEADER;
    P2Util::printInfoHtml();
    echo "<pre>";
    echo $cont_area;
    echo "</pre>";
    echo '</body></html>';
    return true;
}
开发者ID:xingskycn,项目名称:p2-php,代码行数:43,代码来源:viewtxt.php


示例8: rss_get_save_path

/**
 * RSSのURLからローカルに保存するファイルのパスを設定する
 */
function rss_get_save_path($remotefile)
{
    global $_conf;
    static $finished = array();
    $remotefile = preg_replace('|^feed://|', 'http://', $remotefile);
    if (array_key_exists($remotefile, $finished)) {
        return $finished[$remotefile];
    }
    $pURL = @parse_url($remotefile);
    if (!$pURL || !isset($pURL['scheme']) || $pURL['scheme'] != 'http' || !isset($pURL['host'])) {
        $errmsg = 'p2 error: 不正なRSSのURL (' . p2h($remotefile) . ')';
        $error = PEAR::raiseError($errmsg);
        return $finished[$remotefile] = $error;
    }
    $localname = '';
    if (isset($pURL['path']) && $pURL['path'] !== '') {
        $localname .= preg_replace('/[^\\w.]/', '_', substr($pURL['path'], 1));
    }
    if (isset($pURL['query']) && $pURL['query'] !== '') {
        $localname .= '_' . preg_replace('/[^\\w.%]/', '_', $pURL['query']) . '.rdf';
    }
    // 拡張子.cgiや.php等で保存するのを防ぐ
    if (!preg_match('/\\.(rdf|rss|xml)$/i', $localname)) {
        // 古いバージョンで取得したRSSを削除
        if (file_exists($localname)) {
            @unlink($localname);
        }
        // 拡張子.rdfを付加
        $localname .= '.rdf';
    }
    // dotFileが作られるのを防ぐ
    if (substr($localname, 0, 1) == '.') {
        $localname = '_' . $localname;
    }
    $localpath = $_conf['dat_dir'] . '/p2_rss/' . $pURL['host'] . '/' . $localname;
    return $finished[$remotefile] = $localpath;
}
开发者ID:xingskycn,项目名称:p2-php,代码行数:40,代码来源:common.inc.php


示例9: p2h

EOP;
} else {
    $ptitle_ht = <<<EOP
<b>{$ptitle_hd}</b>
EOP;
}
// }}}
// フォーム ==================================================
$sb_form_hidden_ht = <<<EOP
<input type="hidden" name="bbs" value="{$aThreadList->bbs}">
<input type="hidden" name="host" value="{$aThreadList->host}">
<input type="hidden" name="spmode" value="{$aThreadList->spmode}">
{$_conf['detect_hint_input_ht']}{$_conf['k_input_ht']}{$_conf['m_favita_set_input_ht']}
EOP;
// フィルタ検索 ==================================================
$hd['word'] = p2h($word);
$filter_form_ht = '';
$hit_ht = '';
if (!$spmode_without_palace_or_favita) {
    if (array_key_exists('method', $sb_filter) && $sb_filter['method'] == 'or') {
        $hd['method_checked_at'] = ' checked';
    } else {
        $hd['method_checked_at'] = '';
    }
    $filter_form_ht = <<<EOP
<form method="GET" action="{$_conf['subject_php']}" accept-charset="{$_conf['accept_charset']}">
{$sb_form_hidden_ht}<input type="text" id="sb_filter_word" name="word" value="{$hd['word']}" size="15">
<input type="checkbox" id="sb_filter_method" name="method" value="or"{$hd['method_checked_at']}><label for="sb_filter_method">OR</label>
<input type="submit" name="submit_kensaku" value="検索">
</form>
开发者ID:xingskycn,项目名称:p2-php,代码行数:30,代码来源:sb_header_k.inc.php


示例10: updateFavSetList

/**
 * お気に入りセットリストを更新する
 *
 * @return  boolean 更新に成功したらtrue, 失敗したらfalse
 */
function updateFavSetList()
{
    global $_conf;
    if (file_exists($_conf['expack.misc.favset_file'])) {
        $setlist_titles = FavSetManager::getFavSetTitles();
    } else {
        FileCtl::make_datafile($_conf['expack.misc.favset_file']);
    }
    if (empty($setlist_titles)) {
        $setlist_titles = array();
    }
    $setlist_names = array('m_favlist_set', 'm_favita_set', 'm_rss_set');
    foreach ($setlist_names as $setlist_name) {
        if (isset($_POST["{$setlist_name}_titles"]) && is_array($_POST["{$setlist_name}_titles"])) {
            $setlist_titles[$setlist_name] = array();
            for ($i = 0; $i <= $_conf['expack.misc.favset_num']; $i++) {
                if (!isset($_POST["{$setlist_name}_titles"][$i])) {
                    $setlist_titles[$setlist_name][$i] = '';
                    continue;
                }
                $newname = trim($_POST["{$setlist_name}_titles"][$i]);
                $newname = preg_replace('/\\r\\n\\t/', ' ', $newname);
                $newname = p2h($newname);
                $setlist_titles[$setlist_name][$i] = $newname;
            }
        }
    }
    $newdata = serialize($setlist_titles);
    if (FileCtl::file_write_contents($_conf['expack.misc.favset_file'], $newdata) === false) {
        P2Util::pushInfoHtml("<p>p2 error: {$_conf['expack.misc.favset_file']} にお気に入りセット設定を書き込めませんでした。");
        return false;
    }
    return true;
}
开发者ID:xingskycn,项目名称:p2-php,代码行数:39,代码来源:editpref.php


示例11: printf

    $row_format = <<<EOP
<input type="text" name="nga[%1\$d][word]" value="%2\$s"><br>
板:<input type="text" size="5" name="nga[%1\$d][bbs]" value="%5\$s">
<input type="checkbox" name="nga[%1\$d][ignorecase]" value="1"%3\$s>i
<input type="checkbox" name="nga[%1\$d][regex]" value="1"%4\$s>re
<input type="text" name="nga[%1\$d][del]" value="1">×<br>
<input type="hidden" name="nga[%1\$d][lasttime]" value="%6\$s">
<input type="hidden" name="nga[%1\$d][hits]" value="%7\$d">(%6\$d)<br>

EOP;
}
printf($row_format, -1, '', '', '', '', '--', 0);
echo $htm['form_submit'];
if (!empty($formdata)) {
    foreach ($formdata as $k => $v) {
        printf($row_format, $k, p2h($v['word']), $v['ignorecase'], $v['regex'], p2h($v['bbs']), p2h($v['lasttime']), p2h($v['hits']));
    }
    echo $htm['form_submit'];
}
// PCなら
if (!$_conf['ktai']) {
    echo '</table>' . "\n";
}
echo '</form>' . "\n";
// 携帯なら
if ($_conf['ktai']) {
    echo <<<EOP
<hr>
<a {$_conf['accesskey']}="{$_conf['k_accesskey']['up']}" href="editpref.php{$_conf['k_at_q']}">{$_conf['k_accesskey']['up']}.設定編集</a>
{$_conf['k_to_index_ht']}
EOP;
开发者ID:xingskycn,项目名称:p2-php,代码行数:31,代码来源:edit_ng_thread.php


示例12: printf

    $row_format = <<<EOP
Mat:<input type="text" name="dat[%1\$d][match]" value="%2\$s"><br>
Rep:<input type="text" name="dat[%1\$d][replace]" value="%3\$s"><br>
Ref:<input type="text" name="dat[%1\$d][referer]" value="%4\$s"><br>
<input type="text" name="dat[%1\$d][extract]" value="{$EXTRACT}"%5\$s>Exp<br>
Src:<input type="text" name="dat[%1\$d][source]" value="%6\$s"><br>
<input type="text" name="dat[%1\$d][del]" value="1">×<br>


EOP;
}
printf($row_format, -1, '', '', '', '', '', '', '');
echo $htm['form_submit'];
if (!empty($formdata)) {
    foreach ($formdata as $k => $v) {
        printf($row_format, $k, p2h($v['match']), p2h($v['replace']), p2h($v['referer']), p2h($v['extract']), p2h($v['source']), $v['recheck'] ? ' checked' : '', p2h($v['ident']));
    }
    echo $htm['form_submit'];
}
// PCなら
if (!$_conf['ktai']) {
    echo '</table>' . "\n";
}
echo '</form>' . "\n";
// 携帯なら
if ($_conf['ktai']) {
    echo <<<EOP
<hr>
<a {$_conf['accesskey']}="{$_conf['k_accesskey']['up']}" href="editpref.php{$_conf['k_at_q']}">{$_conf['k_accesskey']['up']}.設定編集</a>
{$_conf['k_to_index_ht']}
EOP;
开发者ID:xingskycn,项目名称:p2-php,代码行数:31,代码来源:edit_replace_imageurl.php


示例13: printFavIta

    /**
     * お気に板をプリントする for 携帯
     */
    public function printFavIta()
    {
        global $_conf;
        $show_flag = false;
        // favita読み込み
        if ($lines = FileCtl::file_read_lines($_conf['favita_brd'], FILE_IGNORE_NEW_LINES)) {
            if ($_conf['expack.misc.multi_favs']) {
                $favset_title = FavSetManager::getFavSetPageTitleHt('m_favita_set', 'お気に板');
            } else {
                $favset_title = 'お気に板';
            }
            echo "<div>{$favset_title}";
            if ($_conf['merge_favita']) {
                echo " (<a href=\"{$_conf['subject_php']}?spmode=merge_favita{$_conf['k_at_a']}{$_conf['m_favita_set_at_a']}\">まとめ</a>)";
            }
            echo " [<a href=\"editfavita.php{$_conf['k_at_q']}{$_conf['m_favita_set_at_a']}\">編集</a>]<hr>";
            $i = 0;
            foreach ($lines as $l) {
                $i++;
                if (preg_match("/^\t?(.+)\t(.+)\t(.+)\$/", $l, $matches)) {
                    $itaj = rtrim($matches[3]);
                    $itaj_view = p2h($itaj);
                    $itaj_en = UrlSafeBase64::encode($itaj);
                    if ($i <= 9) {
                        $accesskey_at = $_conf['k_accesskey_at'][$i];
                        $accesskey_st = $_conf['k_accesskey_st'][$i];
                    } else {
                        $accesskey_at = '';
                        $accesskey_st = '';
                    }
                    echo <<<EOP
<a href="{$_conf['subject_php']}?host={$matches[1]}&amp;bbs={$matches[2]}&amp;itaj_en={$itaj_en}{$_conf['k_at_a']}"{$accesskey_at}>{$accesskey_st}{$itaj_view}</a><br>
EOP;
                    //  [<a href="{$_SERVER['SCRIPT_NAME']}?host={$matches[1]}&amp;bbs={$matches[2]}&amp;setfavita=0&amp;view=favita{$_conf['k_at_a']}{$_conf['m_favita_set_at_a']}">削</a>]
                    $show_flag = true;
                }
            }
            echo "</div>";
        }
        if (empty($show_flag)) {
            echo "<p>お気に板はまだないようだ</p>";
        }
    }
开发者ID:xingskycn,项目名称:p2-php,代码行数:46,代码来源:ShowBrdMenuK.php


示例14: elseif

    } elseif (P2Util::isHostMachiBbsNet($aThreadList->host)) {
        // まちビねっと
        $ini_url_text = "http://{$aThreadList->host}/test/read.cgi?bbs={$aThreadList->bbs}&key=";
    } else {
        $ini_url_text = "http://{$aThreadList->host}/test/read.cgi/{$aThreadList->bbs}/";
    }
}
//if(!$aThreadList->spmode || $aThreadList->spmode=="fav" || $aThreadList->spmode=="recent" || $aThreadList->spmode=="res_hist"){
$onclick_ht = <<<EOP
var url_v=document.forms["urlform"].elements["url_text"].value;
if (url_v=="" || url_v=="{$ini_url_text}") {
    alert("見たいスレッドのURLを入力して下さい。 例:http://pc.2ch.net/test/read.cgi/mac/1034199997/");
    return false;
}
EOP;
$onclick_ht = p2h($onclick_ht);
echo <<<EOP
    <form id="urlform" method="GET" action="{$_conf['read_php']}" target="read">
            スレURLを直接指定
            <input id="url_text" type="text" value="{$ini_url_text}" name="url" size="62">
            <input type="submit" name="btnG" value="表\示" onclick="{$onclick_ht}">
    </form>

EOP;
if ($aThreadList->spmode == 'fav' && $_conf['expack.misc.multi_favs']) {
    echo "\t<div style=\"margin:8px 8px;\">\n";
    echo FavSetManager::makeFavSetSwitchForm('m_favlist_set', 'お気にスレ', null, null, false, array('spmode' => 'fav', 'norefresh' => 1));
    echo "\t</div>\n";
}
//}
//================
开发者ID:xingskycn,项目名称:p2-php,代码行数:31,代码来源:sb_footer.inc.php


示例15: foreach

if (!$aThreadList->spmode || $aThreadList->spmode == "taborn" || $aThreadList->spmode == "soko") {
    $htm['change_sort'] .= "<input type=\"hidden\" name=\"host\" value=\"{$aThreadList->host}\">";
    $htm['change_sort'] .= "<input type=\"hidden\" name=\"bbs\" value=\"{$aThreadList->bbs}\">";
}
$htm['change_sort'] .= '<select name="sort">';
foreach ($sorts as $k => $v) {
    if ($GLOBALS['now_sort'] == $k) {
        $sb_sort_selected_at = ' selected';
    } else {
        $sb_sort_selected_at = '';
    }
    $htm['change_sort'] .= "<option value=\"{$k}\"{$sb_sort_selected_at}>{$v}</option>";
}
$htm['change_sort'] .= '</select>';
if (!empty($_REQUEST['sb_view'])) {
    $htm['change_sort'] .= '<input type="hidden" name="sb_view" value="' . p2h($_REQUEST['sb_view']) . '">';
}
if (!empty($_REQUEST['rsort'])) {
    $sb_rsort_checked_at = ' checked';
} else {
    $sb_rsort_checked_at = '';
}
$htm['change_sort'] .= ' <input type="checkbox" id="sb_rsort" name="rsort" value="1"' . $sb_rsort_checked_at . '><label for="sb_rsort">逆順</label>';
$htm['change_sort'] .= ' <input type="submit" value="並び替え"></form>';
// }}}
// HTMLプリント ==============================================
echo '<hr>';
echo $k_sb_navi_ht;
include P2_LIB_DIR . '/sb_toolbar_k.inc.php';
echo $allfav_ht;
echo $switchfavlist_ht;
开发者ID:xingskycn,项目名称:p2-php,代码行数:31,代码来源:sb_footer_k.inc.php


示例16: plugin_replaceImageUrl

 /**
  * 置換画像URL+ImageCache2
  */
 public function plugin_replaceImageUrl($url, $purl, $str)
 {
     static $serial = 0;
     global $_conf;
     global $pre_thumb_unlimited, $pre_thumb_ignore_limit, $pre_thumb_limit;
     // +Wiki
     global $replaceImageUrlCtl;
     $url = $purl[0];
     $replaced = $replaceImageUrlCtl->replaceImageUrl($url);
     if (!$replaced[0]) {
         return false;
     }
     foreach ($replaced as $v) {
         $url_en = rawurlencode($v['url']);
         $url_ht = p2h($v['url']);
         $ref_en = $v['referer'] ? '&amp;ref=' . rawurlencode($v['referer']) : '';
         // 準備
         $serial++;
         $thumb_id = 'thumbs' . $serial . $this->thumb_id_suffix;
         $tmp_thumb = './img/ic_load.png';
         $icdb = new ImageCache2_DataObject_Images();
         // r=0:リンク;r=1:リダイレクト;r=2:PHPで表示
         // t=0:オリジナル;t=1:PC用サムネイル;t=2:携帯用サムネイル;t=3:中間イメージ
         // +Wiki
         $img_url = 'ic2.php?r=1&amp;uri=' . $url_en . $ref_en;
         $thumb_url = 'ic2.php?r=1&amp;t=1&amp;uri=' . $url_en . $ref_en;
         // お気にスレ自動画像ランク
         $rank = null;
         if ($_conf['expack.ic2.fav_auto_rank']) {
             $rank = $this->getAutoFavRank();
             if ($rank !== null) {
                 $thumb_url .= '&rank=' . $rank;
             }
         }
         // DBに画像情報が登録されていたとき
         if ($icdb->get($v['url'])) {
             // ウィルスに感染していたファイルのとき
             if ($icdb->mime == 'clamscan/infected') {
                 $result .= "<img class=\"thumbnail\" src=\"./img/x04.png\" width=\"32\" height=\"32\" hspace=\"4\" vspace=\"4\" align=\"middle\">";
                 continue;
             }
             // あぼーん画像のとき
             if ($icdb->rank < 0) {
                 $result .= "<img class=\"thumbnail\" src=\"./img/x01.png\" width=\"32\" height=\"32\" hspace=\"4\" vspace=\"4\" align=\"middle\">";
                 continue;
             }
             // オリジナルがキャッシュされているときは画像を直接読み込む
             $_img_url = $this->thumbnailer->srcUrl($icdb->size, $icdb->md5, $icdb->mime);
             if (file_exists($_img_url)) {
                 $img_url = $_img_url;
                 $cached = true;
             } else {
                 $cached = false;
             }
             // サムネイルが作成されていているときは画像を直接読み込む
             $_thumb_url = $this->thumbnailer->thumbUrl($icdb->size, $icdb->md5, $icdb->mime);
             if (file_exists($_thumb_url)) {
                 $thumb_url = $_thumb_url;
                 // 自動スレタイメモ機能がONでスレタイが記録されていないときはDBを更新
                 if (!is_null($this->img_memo) && strpos($icdb->memo, $this->img_memo) === false) {
                     $update = new ImageCache2_DataObject_Images();
                     if (!is_null($icdb->memo) && strlen($icdb->memo) > 0) {
                         $update->memo = $this->img_memo . ' ' . $icdb->memo;
                     } else {
                         $update->memo = $this->img_memo;
                     }
                     $update->whereAddQuoted('uri', '=', $v['url']);
                 }
                 // expack.ic2.fav_auto_rank_override の設定とランク条件がOKなら
                 // お気にスレ自動画像ランクを上書き更新
                 if ($rank !== null && self::isAutoFavRankOverride($icdb->rank, $rank)) {
                     if ($update === null) {
                         $update = new ImageCache2_DataObject_Images();
                         $update->whereAddQuoted('uri', '=', $v['url']);
                     }
                     $update->rank = $rank;
                 }
                 if ($update !== null) {
                     $update->update();
                 }
             }
             // サムネイルの画像サイズ
             $thumb_size = $this->thumbnailer->calc($icdb->width, $icdb->height);
             $thumb_size = preg_replace('/(\\d+)x(\\d+)/', 'width="$1" height="$2"', $thumb_size);
             $tmp_thumb = './img/ic_load1.png';
             $orig_img_url = $img_url;
             $orig_thumb_url = $thumb_url;
             // 画像がキャッシュされていないとき
             // 自動スレタイメモ機能がONならクエリにUTF-8エンコードしたスレタイを含める
         } else {
             // 画像がブラックリストorエラーログにあるか確認
             if (false !== ($errcode = $icdb->ic2_isError($v['url']))) {
                 $result .= "<img class=\"thumbnail\" src=\"./img/{$errcode}.png\" width=\"32\" height=\"32\" hspace=\"4\" vspace=\"4\" align=\"middle\">";
                 continue;
             }
             $cached = false;
             $orig_img_url = $img_url;
//.........这里部分代码省略.........
开发者ID:xingskycn,项目名称:p2-php,代码行数:101,代码来源:ShowThreadPc.php


示例17: preg_replace

    if (t) {
        t.resizeTo(w, v);
        t.focus();
        return false;
    } else {
        return true;
    }
})
JS;
$bookmarklet = preg_replace('/\\b(var|return|typeof) +/', '$1{%space%}', $bookmarklet);
$bookmarklet = preg_replace('/\\s+/', '', $bookmarklet);
$bookmarklet = str_replace('{%space%}', ' ', $bookmarklet);
$bookmarklet_k = $bookmarklet . "('{$url_b}k',240,320,20,-100)";
$bookmarklet_i = $bookmarklet . "('{$url_b}i',320,480,20,-100)";
$bookmarklet_k_ht = p2h($bookmarklet_k);
$bookmarklet_i_ht = p2h($bookmarklet_i);
$bookmarklet_k_en = rawurlencode($bookmarklet_k);
$bookmarklet_i_en = rawurlencode($bookmarklet_i);
$htm['ktai_url'] = <<<EOT
<table border="0" cellspacing="0" cellpadding="1">
    <tbody>
        <tr>
            <th>携帯用URL:</th>
            <td><a href="{$url_b_ht}k" target="_blank" onclick="return {$bookmarklet_k_ht};">{$url_b_ht}k</a></td>
            <td>[<a href="javascript:{$bookmarklet_k_en};">bookmarklet</a>]</td>
        </tr>
        <tr>
            <th>iPhone用URL:</th>
            <td><a href="{$url_b_ht}i" target="_blank" onclick="return {$bookmarklet_i_ht};">{$url_b_ht}i</a></td>
            <td>[<a href="javascript:{$bookmarklet_i_en};">bookmarklet</a>]</td>
        </tr>
开发者ID:xingskycn,项目名称:p2-php,代码行数:31,代码来源:title.php


示例18: transLinkDo

 /**
  * リンク対象文字列の種類を判定して対応した関数/メソッドに渡す
  *
  * @param   array   $s
  * @return  string
  */
 public function transLinkDo(array $s)
 {
     global $_conf;
     $orig = $s[0];
     $following = '';
     // PHP 5.2.7 未満の preg_replace_callback() では名前付き捕獲式集合が使えないので
     /*
     if (!array_key_exists('link', $s)) {
         $s['link']  = $s[1];
         $s['quote'] = $s[5];
         $s['url']   = $s[8];
         $s['id']    = $s[11];
     }
     */
     // マッチしたサブパターンに応じて分岐
     // リンク
     if ($s['link']) {
         if (preg_match('{ href=(["\'])?(.+?)(?(1)\\1)(?=[ >])}i', $s[2], $m)) {
             $url = $m[2];
             $str = $s[3];
         } else {
             return $s[3];
         }
         // 引用
     } elseif ($s['quote']) {
         return preg_replace_callback(self::getAnchorRegex('/(%prefix%)?(%a_range%)/'), array($this, '_quoteResCallback'), $s['quote']);
         // http or ftp のURL
     } elseif ($s['url']) {
         if ($_conf['ktai'] && $s[9] == 'ftp') {
             return $orig;
         }
         $url = preg_replace('/^t?(tps?)$/', 'ht$1', $s[9]) . '://' . $s[10];
         $str = $s['url'];
         $following = $s[11];
         if (strlen($following) > 0) {
             // ウィキペディア日本語版のURLで、SJISの2バイト文字の上位バイト
             // (0x81-0x9F,0xE0-0xEF)が続くとき
             if (P2Util::isUrlWikipediaJa($url)) {
                 $leading = ord($following);
                 if (($leading ^ 0x90) < 32 && $leading != 0x80 || ($leading ^ 0xe0) < 16) {
                     $url .= rawurlencode(mb_convert_encoding($following, 'UTF-8', 'CP932'));
                     $str .= $following;
                     $following = '';
                 }
             } elseif (strpos($following, 'tp://') !== false) {
                 // 全角スペース+URL等の場合があるので再チェック
                 $following = $this->transLink($following);
             }
         }
         // ID
     } elseif ($s['id'] && $_conf['flex_idpopup']) {
         // && $_conf['flex_idlink_k']
         return $this->idFilter($s['id'], $s[12]);
         // その他(予備)
     } else {
         return strip_tags($orig);
     }
     // リダイレクタを外す
     switch ($this->_redirector) {
         case self::REDIRECTOR_IMENU:
             $url = preg_replace('{^([a-z]+://)ime\\.nu/}', '$1', $url);
             break;
         case self::REDIRECTOR_PINKTOWER:
             $url = preg_replace('{^([a-z]+://)pinktower\\.com/}', '$1', $url);
             break;
         case self::REDIRECTOR_MACHIBBS:
             $url = preg_replace('{^[a-z]+://machi(?:bbs\\.com|\\.to)/bbs/link\\.cgi\\?URL=}', '', $url);
             break;
     }
     // エスケープされていない特殊文字をエスケープ
     $url = p2h($url, false);
     $str = p2h($str, false);
     // 実態参照・数値参照を完全にデコードしようとすると負荷が大きいし、
     // "&"以外の特殊文字はほとんどの場合URLエンコードされているはずなので
     // 中途半端に凝った処理はせず、"&amp;"→"&"のみ再変換する。
     $raw_url = str_replace('&amp;', '&', $url);
     // URLをパース・ホストを検証
     $purl = @parse_url($raw_url);
     if (!$purl || !array_key_exists('host', $purl) || strpos($purl['host'], '.') === false || $purl['host'] == '127.0.0.1' || P2Util::isHostExample($purl['host'])) {
         return $orig;
     }
     // URLのマッチングで"&amp;"を考慮しなくて済むように、生のURLを登録しておく
     $purl[0] = $raw_url;
     // URLを処理
     foreach ($this->_user_url_handlers as $handler) {
         if (false !== ($link = call_user_func($handler, $url, $purl, $str, $this))) {
             return $link . $following;
         }
     }
     foreach ($this->_url_handlers as $handler) {
         if (false !== ($link = $this->{$handler}($url, $purl, $str))) {
             return $link . $following;
         }
     }
//.........这里部分代码省略.........
开发者ID:xingskycn,项目名称:p2-php,代码行数:101,代码来源:ShowThread.php


示例19: array

if ($execDL) {
    if (is_null($serial)) {
        $URLs = array($params['uri']);
    } else {
        $URLs = array();
        for ($i = $serial['from']; $i <= $serial['to']; $i++) {
            // URLエンコードされた文字列も%を含むので sprintf() は使わない。
            // URLエンコードのフォーマットは%+16進数なので"%s"を置換しても影響しない。
            $URLs[] = str_replace('%s', str_pad($i, $serial['pad'], '0', STR_PAD_LEFT), $params['uri']);
        }
    }
    $thumbnailer = new ImageCache2_Thumbnailer($thumb_type);
    $images = array();
    foreach ($URLs as $url) {
        $icdb = new ImageCache2_DataObject_Images();
        $img_title = p2h($url);
        $url_en = rawurlencode($url);
        $src_url = 'ic2.php?r=1&uri=' . $url_en;
        $thumb_url = 'ic2.php?r=1&t=' . $thumb_type . '&uri=' . $url_en;
        $thumb_x = '';
        $thumb_y = '';
        $img_memo = $new_memo;
        // 画像がブラックリストorエラーログにあるとき
        if (false !== ($errcode 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP p2p_register_connection_type函数代码示例发布时间:2022-05-15
下一篇:
PHP p2die函数代码示例发布时间: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