예제 #1
0
function _smarty_modifier_t_cmd_make_url_js($matches)
{
    $url = str_replace('&', '&', $matches[0]);
    $cmd = $matches[1];
    // SNS内を指すURLの場合は cmd/openpne ディレクトリ以下の小窓を読み込む
    $openpne_url = '';
    if (strpos($url, OPENPNE_URL) === 0) {
        $openpne_url = OPENPNE_URL;
    } elseif (OPENPNE_USE_PARTIAL_SSL && strpos($url, OPENPNE_SSL_URL) === 0) {
        $openpne_url = OPENPNE_SSL_URL;
    }
    if ($openpne_url) {
        $url_pattern = sprintf('/^%s(?:index.php)?\\?m=(\\w+)&a=(\\w+)((?:[a-zA-Z0-9_=]|&)*)$/', preg_quote($openpne_url, '/'));
        $openpne_url_matches = array();
        if (preg_match($url_pattern, $url, $openpne_url_matches)) {
            $module = $openpne_url_matches[1];
            $action = $openpne_url_matches[2];
            $cmd = 'openpne/' . $module . '_' . $action;
        }
    }
    $file = $cmd . '.js';
    $path = './cmd/' . $file;
    // ファイルが読み込めない場合は、小窓キャスト配信者のJavaScriptを読み込む
    if (!is_readable($path)) {
        $path = db_etc_c_cmd_url4name($cmd);
    }
    if (!OPENPNE_USE_CMD_TAG || !db_is_use_cmd($cmd, $GLOBALS['_CMD']['type']) || !$path) {
        if (in_array($GLOBALS['_CMD']['type'], db_get_url2a_denied_list())) {
            // t_url2aが無効: 何もせずに返す
            return $matches[0];
        } else {
            // t_url2aが有効
            return pne_url2a($url);
        }
    }
    $url_html = str_replace('&', '&', $url);
    $result = <<<EOD
<script type="text/javascript" src="{$path}"></script>
<script type="text/javascript">
<!--
url2cmd('{$url_html}', '{$GLOBALS['_CMD']['target_c_member_id']}');
//-->
</script>
EOD;
    return $result;
}
예제 #2
0
function smarty_modifier_t_url2a_callback($matches)
{
    $url = str_replace('&amp;', '&', $matches[0]);
    return pne_url2a($url);
}