/**
 * 「[c:NNN]」形式の絵文字コードをHTML表示用に変換するアウトプットフィルタ
 */
function smarty_outputfilter_pne_display_emoji($tpl_output, &$smarty)
{
    $list = array();
    if (empty($GLOBALS['__Framework']['carrier'])) {
        // 置換用に文字列を退避
        $patterns = array('/<input[^>]+>/is', '/<textarea.*?<\\/textarea>/is', '/<option.*?<\\/option>/is', '/<img[^>]+>/is', '/<head.*?<\\/head>/is', '/<a\\s[^>]+>/is');
        list($list, $tpl_output) = util_replace_patterns_to_marker($tpl_output, $patterns);
    }
    // 絵文字変換
    $tpl_output = emoji_convert($tpl_output);
    if (empty($GLOBALS['__Framework']['carrier'])) {
        // 退避した文字列を元に戻す
        $tpl_output = str_replace(array_keys($list), array_values($list), $tpl_output);
    }
    return $tpl_output;
}
Ejemplo n.º 2
0
/**
 * @copyright 2005-2008 OpenPNE Project
 * @license   http://www.php.net/license/3_01.txt PHP License 3.01
 */
function smarty_modifier_t_url2cmd($string, $type = '', $target_c_member_id = '', $is_html = true)
{
    $list = array();
    if ($type === 'entry_point') {
        // 置換用に文字列を退避
        list($list, $string) = util_replace_patterns_to_marker($string);
    }
    if (!$is_html || in_array($type, db_get_url2a_denied_list())) {
        // HTMLエスケープされていない場合、 t_url2a の変換対象でない場合
        // ", ', </a> がURLの後に続く場合はマッチさせない
        $url_pattern = '/https?:\\/\\/([a-zA-Z0-9\\-.]+)\\/?(?:[a-zA-Z0-9_\\-\\/.,:;~?@=+$%#!()&])*(?!["\'a-zA-Z0-9_\\-\\/.,:;~?@=+$%#!()&]|<\\/a>)/';
    } else {
        $url_pattern = '/https?:\\/\\/([a-zA-Z0-9\\-.]+)\\/?(?:[a-zA-Z0-9_\\-\\/.,:;~?@=+$%#!()]|&amp;)*/';
    }
    $GLOBALS['_CMD']['type'] = $type;
    $GLOBALS['_CMD']['target_c_member_id'] = $target_c_member_id;
    $string = preg_replace_callback($url_pattern, '_smarty_modifier_t_cmd_make_url_js', $string);
    if ($type === 'entry_point') {
        // 退避した文字列を元に戻す
        $string = str_replace(array_keys($list), array_values($list), $string);
    }
    return $string;
}