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
<html> | |
<head><title>Hello</title></head> | |
<body><p>Hello, world!</p></body> | |
</html> |
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 | |
//For PHP 5.3.x or later | |
public function emailExtended($data, $deep = false) { | |
$pattern = '/.+@(docomo|ezweb)\.ne\.jp$/i'; | |
$check = preg_replace_callback($pattern, function($matches) { | |
$patterns = array('/\.{2,}/', '/\.@/'); | |
$replacements = array('.', '@'); | |
return preg_replace($patterns, $replacements, $matches[0]); | |
}, array_shift($data)); | |
return Validation::email($check, $deep); |
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 mb_strimlen($str, $start, $length, $trimmarker = '', $encoding = false) { | |
$encoding = $encoding ? $encoding : mb_internal_encoding(); | |
$str = mb_substr($str, $start, mb_strlen($str), $encoding); | |
if (mb_strlen($str, $encoding) > $length) { | |
$markerlen = mb_strlen($trimmarker, $encoding); | |
$str = mb_substr($str, 0, $length - $markerlen, $encoding) . $trimmarker; | |
} | |
return $str; | |
} |
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
<meta property="fb:admins" content="100002501170896" /> | |
<meta property="fb:app_id" content="285724981447786" /> | |
<meta property="og:url" content="http://www.msng.info/" /> | |
<meta property="og:type" content="blog" /> | |
<meta property="og:title" content="頭ん中" /> | |
<meta property="og:locale" content="ja_JP" /> | |
<meta property="og:site_name" content="頭ん中" /> | |
<meta property="og:image" content="http://www.msng.info/wp-content/themes/msng/img/favicon4.png" /> | |
<meta property="og:description" content="インターネットやコミュニケーションの話題を中心に、思ったことをつらつらと書いていくブログです。" /> |
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 | |
/** | |
* Ogp Helper class file | |
* | |
* Adds OGP elements in <head /> | |
* | |
* Licensed under The MIT License | |
* | |
* @author Masunaga Ray (http://www.msng.info/) | |
* @link http://www.msng.info/archives/2011/12/cakephp-ogp-helper.php |
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
<script type="text/javascript">if (window.top != window.self) window.top.location = window.self.location;</script> |
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 number_unformat($number, $force_number = true, $dec_point = '.', $thousands_sep = ',') { | |
if ($force_number) { | |
$number = preg_replace('/^[^\d]+/', '', $number); | |
} else if (preg_match('/^[^\d]+/', $number)) { | |
return false; | |
} | |
$type = (strpos($number, $dec_point) === false) ? 'int' : 'float'; | |
$number = str_replace(array($dec_point, $thousands_sep), array('.', ''), $number); | |
settype($number, $type); |
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
<!-- | |
・できれば <body> タグの直後に置く | |
・日本語ボタンを出すなら en_US を ja_JP にする | |
・アプリケーションIDをつける場合は、xfbml=1 の後に | |
&appId=[Facebookで取得するアプリケーションID: https://developers.facebook.com/apps ] | |
をつける | |
--> | |
<div id="fb-root"></div> | |
<script>(function(d, s, id) { | |
var js, fjs = d.getElementsByTagName(s)[0]; |
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 is_hankaku($str, $include_kana = false, $include_controls = false, $encoding = null) { | |
if (!$include_controls && !ctype_print($str)) { | |
return false; | |
} | |
if (is_null($encoding)) { | |
$encoding = mb_internal_encoding(); | |
} | |
if ($include_kana) { |
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 | |
//Requires function is_hankaku() https://gist.github.com/2167287 | |
function is_zenkaku($str, $encoding = null) { | |
if (is_null($encoding)) { | |
$encoding = mb_internal_encoding(); | |
} | |
$len = mb_strlen($str, $encoding); | |
for ($i = 0; $i < $len; $i++) { | |
$char = mb_substr($str, $i, 1, $encoding); | |
if (is_hankaku($char, true, true, $encoding)) { |
OlderNewer