Skip to content

Instantly share code, notes, and snippets.

View mingtsay's full-sized avatar
🇹🇼

Ming Tsay mingtsay

🇹🇼
View GitHub Profile
@mingtsay
mingtsay / dataurl.php
Created May 1, 2011 05:59
Data URL Praser
<?php
# Demo: http://mt.aa.am/dataurl.php
# data:[<MIME-type>][;charset=<encoding>][;base64],<data>
if(isset($_GET['uri']) || isset($_POST['uri']) || isset($_GET['file'])) {
if(isset($_GET['uri'])) $uri = $_GET['uri'];
else if(isset($_POST['uri'])) $uri = $_POST['uri'];
else if(isset($_GET['file'])) {
$file = $_GET['file'];
if(!(strtolower(substr($file, 0, 7)) == "http://" || strtolower(substr($file, 0, 8)) == "https://"))
@mingtsay
mingtsay / mt.gettext.php
Created April 30, 2011 14:36
mt's gettext
<?php
/**
* Define: FILE_ROOT_PATH
* Set Value: $lang
* Create an ini file: i18n/lang.ini
* Call function: _gettext("Homepage") or someelse string
**/
function _gettext($text) {
global $lang;
$langs = parse_ini_file(FILE_ROOT_PATH . "i18n/lang.ini", true);