This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function fsock_mail($from,$to,$subject,$body){ | |
$server='localhost';//メールサーバ | |
$port=25;//ポート番号 | |
$timeout=30;//タイムアウト(秒) | |
//件名の文字コード変換 | |
$subject=mb_convert_encoding($subject,'iso-2022-jp',mb_internal_encoding()); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function multi_get($urls,$options=array()){ | |
$result=array(); | |
$mh=curl_multi_init(); | |
$curly=array(); | |
foreach($urls as $key=>$url){ | |
if(empty($url) || is_array($url) || !preg_match('/^(ftp|http)/',$url)){ | |
if (is_readable($url)) { | |
$result[$key] = file_get_contents($url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
使用方法 | |
$('input[name="date"]').dateSelector({ | |
format:'y-m-d', //日付選択後、hiddenフォームに入る日付の形式。「y」「m」「d」(すべて小文字)がそれぞれ置換されます | |
date:'today', //初期表示日付。yyyy-mm-ddまたはyyyy/mm/ddまたは「today」もしくは「now」に対応 | |
year:'2000,+2' //年の範囲。「最小年,最大年」の形式で、年そのものか、「+2(年)」「-3(年)」に対応 | |
block:false, //年、月、日のプルダウンがまとまったものをブロック要素(div)にするか、インライン要素(span)にするか | |
before:false, //hiddenフォームの前に挿入する場合はtrue | |
onchange:function(y,m,d){} //各プルダウンの選択後(全て値が入っている場合)に実行する関数。年、月、日の数値が渡される | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
TwitterのNotification Bar風のやつ | |
【使い方】 | |
<button onclick="$.notifyBar('表示したい文字');return false;">押して</button> | |
<a href="#" onclick="$.notifyBar('表示したい文字','warning');return false;">ここクリック</a> | |
など |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function shorten($arg){ | |
if(empty($arg)){ | |
return NULL; | |
} | |
static $_out; | |
if(!empty($_out[$arg])){ | |
return $_out[$arg]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function complementary($hex){ | |
static $_out; | |
if(!empty($_out[$hex])){ | |
return $_out[$hex]; | |
} | |
$_out=array(); | |
$in=(strpos($hex,'#')===0) ? substr($hex,1) : $hex; | |
$in=strtoupper($in); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//キャッシュディレクトリ。最後は必ずスラッシュ。 | |
define('CACHE_DIR','path/to/cachedir/'); | |
//ファイルキャッシュ関数。 | |
//引数「$id」と引数「$data」に値が入るとキャッシュ保存。引数「$id」のみで引数「$data」が空ならキャッシュ参照。 | |
//引数「$id」はスラッシュ区切りでキャッシュディレクトリ内にさらにフォルダ作成(デフォルトでは「default」という名前で作成)。 | |
//引数「$data」に「false」を指定すると、該当$idのキャッシュファイルを削除。 | |
//引数「$minute」はキャッシュ時間(分単位)。キャッシュ保存時のみ必要。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function str_wordwrap($str,$max=NULL,$indent=NULL,$firstindent=true,$charset='utf8'){ | |
$max=(empty($max) ? 74 : (($max%2==0) ? $max-1 : $max)); | |
$str=str_replace("\r\n","\n",$str); | |
$sindent=mb_convert_encoding($indent,'sjis',$charset); | |
$ilen=(!empty($indent)) ? strlen($sindent) : 0; | |
$arr=array(); | |
$out=NULL; | |
foreach(explode("\n",$str) as $line){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
var adoModal_initialized=false; | |
$.fn.extend({ | |
adoModal:function(options){ | |
if($.browser.msie && $.browser.version<=6){ | |
return false; | |
} | |
options=$.extend({ | |
fade:100, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var u='/redirect/path.html';//リダイレクト先のURL | |
var mes='スマートフォン用サイトに移動しますか?';//アラートのメッセージ | |
var cn='smartphone_redirect_canceled';//Cookie名 | |
var cm=60;//Cookieのキャッシュ時間(分) | |
var cp='/';//Cookieのパス | |
var ua=navigator.userAgent; | |
//スマホページから来た場合は表示しない | |
if(document.referrer && document.referrer.indexOf(u)!=-1){ | |
//Cookieに書き込む |