[PR] 美容整形 at 東京


 #topicpath
 *謎の文章メモ [#if680cc4]
 teao
 ssh
 teao ssh トンネル~
 研究 ajax 単語スコア付け wikipedia
 
 トンネル
 //Ethernet adapter ローカル エリア接続:
 //
 //        Connection-specific DNS Suffix  . :
 //        Description . . . . . . . . . . . : Intel(R) PRO/100 VE Desktop Connecti on
 //        Physical Address. . . . . . . . . : 00-02-55-37-AB-FC
 //        Dhcp Enabled. . . . . . . . . . . : Yes
 
 #code(c,number,icon,outline){{
 #include <stdio.h>
 main(){
   int var;
 
   var = 1;
 
   printf("adsf%d",var);
 }
 }}
 
 #code(php,number,icon,outline){{
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone.
 // $Id: func.php,v 1.73.7 2006/06/06 16:41:39 miko Exp $
 // Copyright (C)
 //   2005-2006 PukiWiki Plus! Team
 //   2002-2006 PukiWiki Developers Team
 //   2001-2002 Originally written by yu-ji
 // License: GPL v2 or (at your option) any later version
 //
 // General functions
 
 function is_interwiki($str)
 {
 	global $InterWikiName;
 	return preg_match('/^' . $InterWikiName . '$/', $str);
 }
 
 function is_pagename($str)
 {
 	global $BracketName;
 
 	$is_pagename = (! is_interwiki($str) &&
 		  preg_match('/^(?!\/)' . $BracketName . '$(?<!\/$)/', $str) &&
 		! preg_match('#(^|/)\.{1,2}(/|$)#', $str));
 
 	if (defined('SOURCE_ENCODING')) {
 		switch(SOURCE_ENCODING){
 		case 'UTF-8': $pattern =
 			'/^(?:[\x00-\x7F]|(?:[\xC0-\xDF][\x80-\xBF])|(?:[\xE0-\xEF][\x80-\xBF][\x80-\xBF]))+$/';
 			break;
 		case 'EUC-JP': $pattern =
 			'/^(?:[\x00-\x7F]|(?:[\x8E\xA1-\xFE][\xA1-\xFE])|(?:\x8F[\xA1-\xFE][\xA1-\xFE]))+$/';
 			break;
 		}
 		if (isset($pattern) && $pattern != '')
 			$is_pagename = ($is_pagename && preg_match($pattern, $str));
 	}
 
 	return $is_pagename;
 }
 
 function is_url($str, $only_http = FALSE)
 {
 	$scheme = $only_http ? 'https?' : 'https?|ftp|news';
 	return preg_match('/^(' . $scheme . ')(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]*)$/', $str);
 }
 
 // If the page exists
 function is_page($page, $clearcache = FALSE)
 {
 	if ($clearcache) clearstatcache();
 	return file_exists(get_filename($page));
 }
 
 function is_editable($page)
 {
 	global $cantedit;
 	static $is_editable = array();
 
 	if (! isset($is_editable[$page])) {
 		$is_editable[$page] = (
 			is_pagename($page) &&
 			! is_freeze($page) &&
 			! in_array($page, $cantedit)
 		);
 	}
 
 	return $is_editable[$page];
 }
 
 function is_freeze($page, $clearcache = FALSE)
 {
 	global $function_freeze;
 	static $is_freeze = array();
 
 	if ($clearcache === TRUE) $is_freeze = array();
 	if (isset($is_freeze[$page])) return $is_freeze[$page];
 
 	if (! $function_freeze || ! is_page($page)) {
 		$is_freeze[$page] = FALSE;
 		return FALSE;
 	} else {
 		$fp = fopen(get_filename($page), 'rb') or
 			die('is_freeze(): fopen() failed: ' . htmlspecialchars($page));
 		flock($fp, LOCK_SH) or die('is_freeze(): flock() failed');
 		rewind($fp);
 		$buffer = fgets($fp, 9);
 		flock($fp, LOCK_UN) or die('is_freeze(): flock() failed');
 		fclose($fp) or die('is_freeze(): fclose() failed: ' . htmlspecialchars($page));
 
 		$is_freeze[$page] = ($buffer != FALSE && rtrim($buffer, "\r\n") == '#freeze');
 		return $is_freeze[$page];
 	}
 }
 
 // Handling $non_list
 // $non_list will be preg_quote($str, '/') later.
 function check_non_list($page = '')
 {
 	global $non_list;
 	static $regex;
 
 	if (! isset($regex)) $regex = '/' . $non_list . '/';
 
 	return preg_match($regex, $page);
 }
 
 // Auto template
 function auto_template($page)
 {
 	global $auto_template_func, $auto_template_rules;
 
 	if (! $auto_template_func) return '';
 
 	$body = '';
 	$matches = array();
 	foreach ($auto_template_rules as $rule => $template) {
 		$rule_pattrn = '/' . $rule . '/';
 
 		if (! preg_match($rule_pattrn, $page, $matches)) continue;
 
 		$template_page = preg_replace($rule_pattrn, $template, $page);
 		if (! is_page($template_page)) continue;
 
 		$body = join('', get_source($template_page));
 
 		// Remove fixed-heading anchors
 		$body = preg_replace('/^(\*{1,3}.*)\[#[A-Za-z][\w-]+\](.*)$/m', '$1$2', $body);
 
 		// Remove '#freeze'
 		$body = preg_replace('/^#freeze\s*$/m', '', $body);
 
 		$count = count($matches);
 		for ($i = 0; $i < $count; $i++)
 			$body = str_replace('$' . $i, $matches[$i], $body);
 
 		break;
 	}
 	return $body;
 }
 
 // Expand all search-words to regexes and push them into an array
 function get_search_words($words = array(), $do_escape = FALSE)
 {
 	static $init, $mb_convert_kana, $pre, $post, $quote = '/';
 
 	if (! isset($init)) {
 		// function: mb_convert_kana() is for Japanese code only
 		if (LANG == 'ja' && function_exists('mb_convert_kana')) {
 			$mb_convert_kana = create_function('$str, $option',
 				'return mb_convert_kana($str, $option, SOURCE_ENCODING);');
 		} else {
 			$mb_convert_kana = create_function('$str, $option',
 				'return $str;');
 		}
 		if (SOURCE_ENCODING == 'EUC-JP') {
 			// Perl memo - Correct pattern-matching with EUC-JP
 			// http://www.din.or.jp/~ohzaki/perl.htm#JP_Match (Japanese)
 			$pre  = '(?<!\x8F)';
 			$post =	'(?=(?:[\xA1-\xFE][\xA1-\xFE])*' . // JIS X 0208
 				'(?:[\x00-\x7F\x8E\x8F]|\z))';     // ASCII, SS2, SS3, or the last
 		} else {
 			$pre = $post = '';
 		}
 		$init = TRUE;
 	}
 
 	if (! is_array($words)) $words = array($words);
 
 	// Generate regex for the words
 	$regex = array();
 	foreach ($words as $word) {
 		$word = trim($word);
 		if ($word == '') continue;
 
 		// Normalize: ASCII letters = to single-byte. Others = to Zenkaku and Katakana
 		$word_nm = $mb_convert_kana($word, 'aKCV');
 		$nmlen   = mb_strlen($word_nm, SOURCE_ENCODING);
 
 		// Each chars may be served ...
 		$chars = array();
 		for ($pos = 0; $pos < $nmlen; $pos++) {
 			$char = mb_substr($word_nm, $pos, 1, SOURCE_ENCODING);
 
 			// Just normalized one? (ASCII char or Zenkaku-Katakana?)
 			$or = array(preg_quote($do_escape ? htmlspecialchars($char) : $char, $quote));
 			if (strlen($char) == 1) {
 				// An ASCII (single-byte) character
 				foreach (array(strtoupper($char), strtolower($char)) as $_char) {
 					if ($char != '&') $or[] = preg_quote($_char, $quote); // As-is?
 					$ascii = ord($_char);
 					$or[] = sprintf('&#(?:%d|x%x);', $ascii, $ascii); // As an entity reference?
 					$or[] = preg_quote($mb_convert_kana($_char, 'A'), $quote); // As Zenkaku?
 				}
 			} else {
 				// NEVER COME HERE with mb_substr(string, start, length, 'ASCII')
 				// A multi-byte character
 				$or[] = preg_quote($mb_convert_kana($char, 'c'), $quote); // As Hiragana?
 				$or[] = preg_quote($mb_convert_kana($char, 'k'), $quote); // As Hankaku-Katakana?
 			}
 			$chars[] = '(?:' . join('|', array_unique($or)) . ')'; // Regex for the character
 		}
 
 		$regex[$word] = $pre . join('', $chars) . $post; // For the word
 	}
 
 	return $regex; // For all words
 }
 
 }}
 

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS