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 | |
namespace Phanda; | |
use Phanda; | |
class Util { | |
public static function encrypt($source, $key, $iv, $toBase64Encode=true) | |
{ | |
$mcrypt_resource = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, ''); | |
$mcrypt_key_size = mcrypt_enc_get_key_size($mcrypt_resource); |
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
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} !__gateway\.php$ | |
RewriteRule .* __gateway.php [L] |
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('Auth_Yadis_CURL_OVERRIDE', '1'); // Curlは使わない | |
define('Auth_OpenID_RAND_SOURCE' , | |
(!file_exists('/dev/urandom') || !is_readable('/dev/urandom')) | |
? '/dev/urandom' : null); | |
if (!isset($_SESSION)) { | |
session_start(); | |
} | |
class Util { |
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 | |
namespace Holy; | |
// キーにzero-paddingした半角数字、テキストに全角数字を持つ日付選択用の配列を生成する | |
class Util { | |
public static function H($data) { | |
if (isset($data) && strlen($data) >= 1) { | |
$data = htmlspecialchars($data, ENT_QUOTES, 'UTF-8'); | |
} | |
return $data; |
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 | |
$array = range(0, 10000); | |
$options = array_combine( | |
array_map(function($i) { | |
return sha1($i); | |
}, $array), | |
array_map(function($i) { | |
return crc32($i); | |
}, $array)); |
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 | |
namespace Holy\Tests; | |
use Holy\Loader; | |
/** | |
* LoaderTest | |
* | |
* @author [email protected] | |
*/ |
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 | |
error_reporting(E_ALL|E_STRICT); | |
if (defined('E_DEPRECATED')) { | |
error_reporting(error_reporting() & ~E_DEPRECATED); | |
} | |
mb_detect_order('ASCII,EUC-JP,SJIS,JIS,UTF-8'); | |
class U | |
{ | |
public static function NL($data) { |
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
<pre> | |
<?php | |
// array_map()で解くFizzBuzz | |
echo implode("\n", array_map(function($var) { | |
return ($var % 3 * $var % 5) ? $var : ($var % 3 ? '' : 'Fizz') . ($var % 5 ? '' : 'Buzz'); | |
}, range(1, 100))); | |
?> | |
</pre> |
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 | |
namespace Holy\Example; | |
class Util { | |
public static function H($data, $default=null) { | |
$var = $default; | |
if (isset($data) && is_scalar($data) && strlen($data) >= 1) { | |
$var = htmlspecialchars($data, \ENT_QUOTES, 'UTF-8'); | |
} | |
return $var; |
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 | |
set_include_path(realpath(__DIR__ . '/../lib') . PATH_SEPARATOR . | |
get_include_path()); | |
// spl_autoload_functions()の挙動:登録前 | |
var_dump(spl_autoload_functions()); // bool(false) | |
// include_path 前提のPEAR形式クラスの場合、最低これだけでも動く | |
function autoload($className) { | |
return @include str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; |
OlderNewer