コード例 #1
0
ファイル: ame_bbcode.php プロジェクト: holandacz/nb4
/**
 * Parses bbcode but only if it is being shown... NOT in the editor
 *
 * @param unknown_type $parser
 * @param unknown_type $text
 * @param unknown_type $id
 * @return unknown
 */
function ame_process_bbcode(&$parser, &$param1, $param2 = '')
{
    if (class_exists('vB_BbCodeParser_Wysiwyg') and is_a($parser, 'vB_BbCodeParser_Wysiwyg')) {
        return $text;
    } else {
        global $vbulletin;
        ($hook = vBulletinHook::fetch_hook('automediaembed_parse_bbcode_start')) ? eval($hook) : false;
        $ameinfo = fetch_full_ameinfo();
        $text = preg_replace($ameinfo['find'], $ameinfo['replace'], $param2 ? $param2 : $param1, 1);
        ($hook = vBulletinHook::fetch_hook('automediaembed_parse_bbcode_end')) ? eval($hook) : false;
        return $text;
    }
}
コード例 #2
0
/**
 * Writes the contents of $ameinfo to a file to avoid a DB query and array build.
 *
 * @return boolean
 */
function ame_write_cache()
{
    global $vbulletin;
    $path = $vbulletin->options['automediaembed_cache_path'];
    if (!$vbulletin->options['automediaembed_cache'] or !$path) {
        return false;
    }
    if (!strrpos($path, "/")) {
        if (!strrpos($path, "\\")) {
            $path .= '/';
        }
    }
    if (!is_dir($path)) {
        return false;
    }
    require_once DIR . '/includes/ame_bbcode.php';
    $findonly = fetch_full_ameinfo(true, true);
    $output = "<?php\n";
    $output .= ame_write_array_entry($findonly, '$ameinfo');
    $output .= "\n?>";
    ame_write_to_file($path, "findonly", $output);
    $ameinfo = fetch_full_ameinfo(false, true);
    $output = "<?php\n";
    $output .= ame_write_array_entry($ameinfo, '$ameinfo');
    $output .= "\n?>";
    ame_write_to_file($path, "ameinfo", $output);
}